الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

رفع ملفات الفيديو عن طريق الjsp &servlet

بدأه فريز في 12 ديسمبر 2009 · 1 رد · 602 مشاهدة · في JavaEE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم الاخوه الاعضاء اريد ان استفسر عن رفع ملفات الفيديو فقط استخدمت الابلود بينز الموجود في الجافا زووم

لكن المشكله هي ان الكود لايقبل سوا رفع ملفات فيديو بامتداد واحد وهو mpg ماادري هل هذا غير ممكن ولا مستحيل يكون الرفع الا بامتداد واحد

سوف اضع الكود اللي عملته ارجو مساعدتي

<html xmlns="http://www.w3.org/1999/xhtml" dir="rtl">
<%@ page contentType="text/html; charset=windows-1256" language="java" import="javazoom.upload.*,java.util.*,java.sql.*" %>

<% request.setCharacterEncoding("windows-1256");%>
<% response.setCharacterEncoding("windows-1256");
String v=(String)request.getAttribute("vedio");%>

<jsp:useBean id="upBean" scope="page" class="javazoom.upload.UploadBean" >
 <jsp:setProperty name="upBean" property="folderstore" value="C:\Users\eman\Documents\NetBeansProjects\PIC\web\uploads" />
</jsp:useBean>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256" />
<title>رفع الملفات</title>

</head>

<body style="font-family:Arabic Transparent; font-size:20px;">
<center>
<form method="post" action="upload.jsp" name="MyForm" enctype="multipart/form-data" onsubmit="return Check();">
 <table border="0" cellspacing="1" cellpadding="1" align="center">
 <tr>
 <td align="right"><b>اختر الملف للرفع</b></td>
 </tr>
 <tr>
 <td align="center">
 <input type="file" name="uploadfile" size="50"/>
 </td>
 </tr>
 <tr>
 <td align="left">
		<input type="hidden" name="todo" value="upload"/>
 <input type="submit" name="Submit" value="رفع"/>
 <input type="reset" name="Reset" value="إلغاء"/>
 </td>
 </tr>

 </table>
</form>

<table style="font-family:Arabic Transparent; font-size:20px;"><tr><td align="right">
<%
 if (MultipartFormDataRequest.isMultipartFormData(request))
 {
 // Uses MultipartFormDataRequest to parse the HTTP request.
 MultipartFormDataRequest mrequest = new MultipartFormDataRequest(request);

 String todo = null;
 if (mrequest != null) todo = mrequest.getParameter("todo");
 if ( (todo != null) && (todo.equalsIgnoreCase("upload")) )
 {
 Hashtable files = mrequest.getFiles();
 if ( (files != null) && (!files.isEmpty()) )
 {
 UploadFile file = (UploadFile) files.get("uploadfile");
 if (file.getFileName() != null) {




 //out.println("<a target='_blank' href='uploads/"+file.getFileName()+"'"+">http://localhost:8080/PIC/uploads/"+file.getFileName()+"</a>");
 out.println("<embed src="+"'"+ "http://localhost:8080/PIC/uploads/"+file.getFileName()+"'"+"autostart="+"'"+"false"+"'"+"style="+"'"+"width:300px;height:250px;"+"'"+"/embed>");

 //String vedio=( "http://localhost:8080/PIC/uploads/"+file.getFileName());
 upBean.store(mrequest, "uploadfile");



					try {


					}
					catch (Exception e){
					out.println(e);
					}


					}
					else
					{
					out.println("الرجاء اختيار الملف");
					}
 }
 else
 {
 out.println("<li>لم يتم رفع الملفات");
 }
 }
 else out.println("<BR> todo="+todo);
 }
%>

</td></tr></table>
</center>
</body>
</html>

تم تعديل هذه المشاركة بواسطة herch في 12 ديسمبر 2009 في 01:44 — السبب: إضافة الوسم code

#2

معرفتي قليلة جدا بservlet، لكن ممكن تجرب مكتبة أخرى إذا لم تعمل تلك التي تستعمل http://commons.apache.org/fileupload

مواضيع مشابهة