الانتقال إلى المحتوى
View in the app

A better way to browse. Learn more.

مجموعة مستخدمي أوراكل العربية

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Upload Download File

Featured Replies

بتاريخ:

هل يوجد مكتبه يجب ان اضيفها اقصد libarary

مكتبة JSF

  • الردود 47
  • المشاهدات 4.9k
  • البداية
  • اخر رد

أكثر المشاركين في هذا الموضوع

بتاريخ:

 

 

السلام عليكم 

بعمل download ل file بالكود ده

    public String  downloadFileListener() throws IOException {
           HttpServletResponse response = getResponse();
           PrintWriter out = response.getWriter();  
          // ServletOutputStream out = response.getOutputStream();
          // response.setContentType("image/jpeg");
           response.setContentType("APPLICATION/OCTET-STREAM");
           String filename = it2.getValue().toString()+".jpg";  
           String filepath = "\\\\server_ip\\Certificate\\";   
           response.setContentType("APPLICATION/OCTET-STREAM");   
           response.setHeader("Content-Disposition","attachment; filename=\"" + filename + "\"");   
           FileInputStream fileInputStream = new FileInputStream(filepath + filename);  
                       
           int i;   
           while ((i=fileInputStream.read()) != -1) {  
           out.write(i);   
           }   
           fileInputStream.close();   
           out.close();   
           
        return null;
 

 

       }

 

 

 

 

 

 

 

 

بيطلعلى الerror ده ومبيخلينش اعمل اى حاجة فى الصفحة ازاى احل المشكلة دى

 

 

 

 

java.lang.IllegalStateException: Cannot forward a response that is already committed

احذف السطر            out.close();   

حذفت السطر يا بشمهندس ومازال نفس الخطا 

 

 

java.lang.IllegalStateException: Cannot forward a response that is already committed
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:126)
at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:546)
at javax.faces.context.ExternalContextWrapper.dispatch(ExternalContextWrapper.java:93)
at javax.faces.context.ExternalContextWrapper.dispatch(ExternalContextWrapper.java:93)
at javax.faces.context.ExternalContextWrapper.dispatch(ExternalContextWrapper.java:93)
at oracle.adfinternal.view.faces.config.rich.RecordRequestAttributesDuringDispatch.dispatch(RecordRequestAttributesDuringDispatch.java:44)
at javax.faces.context.ExternalContextWrapper.dispatch(ExternalContextWrapper.java:93)
at javax.faces.context.ExternalContextWrapper.dispatch(ExternalContextWrapper.java:93)
at org.apache.myfaces.trinidadinternal.context.FacesContextFactoryImpl$OverrideDispatch.dispatch(FacesContextFactoryImpl.java:167)
at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:364)
at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:154)
at org.apache.myfaces.trinidad.view.ViewDeclarationLanguageWrapper.buildView(ViewDeclarationLanguageWrapper.java:94)
at org.apache.myfaces.trinidad.view.ViewDeclarationLanguageWrapper.buildView(ViewDeclarationLanguageWrapper.java:94)
at org.apache.myfaces.trinidadinternal.application.ViewDeclarationLanguageFactoryImpl$ChangeApplyingVDLWrapper.buildView(ViewDeclarationLanguageFactoryImpl.java:322)
at oracle.adfinternal.view.faces.lifecycle.ResponseRenderManager._processViewDefinitionLanguage(ResponseRenderManager.java:105)
at oracle.adfinternal.view.faces.lifecycle.ResponseRenderManager.runRenderView(ResponseRenderManager.java:41)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:1095)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:389)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:255)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280)

 

أرجو تجربة fileDownloadActionListener

بتاريخ:




هل يوجد مكتبه يجب ان اضيفها اقصد libarary

مكتبة JSF[/quote
تمام اذن المكتبه اسمهاjsf وماهي علاقتها باظهار message
بتاريخ:

ما هذا؟

بتاريخ:

اعتزر يوجد خطا بتعقيب الرساله
اقصد اسم المكتبه بالكاملjsf .?

بتاريخ:

نعم ويليها رقم إصدار المكتبة

بتاريخ:

اخي وجدت المكتبه موجوده في الابلكيشن

بتاريخ:

حسناً وما المشكلة الآن؟

بتاريخ:

المشكله انه في الكود المذكور انفا عند وضع الداله في الكلاس تظهر الرساله ولايرسل الملف
علما بان الكود يعمل بدون الرساله ماذا افعل

بتاريخ:

لم أفهم

بتاريخ:

view;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

import javax.faces.application.FacesMessage;

import javax.faces.context.FacesContext;

import oracle.adf.model.BindingContext;

import oracle.binding.AttributeBinding;
import oracle.binding.BindingContainer;

import org.apache.myfaces.trinidad.model.UploadedFile;

public class UploadClass {

private UploadedFile _File;
public UploadClass() {
}

public String UploadProcess() {
// Add event code here...

String imagesFolder = "C:\\upload_id\\";

File myFile = new File(imagesFolder);

if ( !myFile.exists() ) { myFile.mkdir(); }

String newImageFile = imagesFolder + this.getCurrentId()+".rar";

try {

InputStream inputStream = getFile().getInputStream();

FileOutputStream outputStram = new FileOutputStream(newImageFile);


byte[] buffer = new byte[8192];

int bytesRead = 0;



while ((bytesRead = inputStream.read(buffer)) != -1) {

outputStram.write(buffer, 0, bytesRead);

}

outputStram.flush();

outputStram.close();

inputStream.close();

getFile().dispose();



} catch (FileNotFoundException fnfe) {

// TODO: Add catch code

fnfe.printStackTrace();

} catch (IOException ioe) {

// TODO: Add catch code

ioe.printStackTrace();

}

return null;
}
public void setFile(UploadedFile _File) {

this._File = _File;

}

public UploadedFile getFile() {

return _File;

}

public String getCurrentId() {

BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();

AttributeBinding attr = (AttributeBinding)bindings.getControlBinding("Id");

return attr.getInputValue().toString().trim();





}




}


اخي هذا الكود يعمل upload وشغال مظبوط
اريد اظهار رساله بعد ان يتم ارسال الملف للطرف الاخر ..... حاولت كثير من المحاولات عن طريق facesmessage ولاجدوي
1/عند وضع الرساله في نهايه الكلاس لاتعمل
2/وضعتها في كذا مكان في الكلاس وتظهر الرساله ولكن لايرسل الملف..
ماذا افعل.؟

بتاريخ:

ضعها قبل السطر 

return null;

بتاريخ:

تمام ساجرب اذن

بتاريخ:

جزاك الله الف خير ياباشمهندس الف الف شكر اشتغلت معي مظبوط الحمدلله 

بتاريخ:

الحمد لله

بتاريخ:

 

السلام عليكم 

عملت تطبيق يقوم بتحميل ملفات الى السيرفر بأستخدام الطريقة الموجود في المدونه التالية

http://www.awasthiashish.com/2014/08/uploading-and-downloading-files-from.html

 

في هذه الطريقة اكبر حجم يمكن رفعة هو 2MB

المطلوب كيف يمكن زيادة حجم الملف عن 2MB 

وبأستخدام الكود التالي

Bean Method to Upload File
/**Method to upload file to actual path on Server*/
    private String uploadFile(UploadedFile file) {

        UploadedFile myfile = file;
        String path = null;
        if (myfile == null) {

        } else {
            // All uploaded files will be stored in below path
            path = "D://FileStore//" + myfile.getFilename();
            InputStream inputStream = null;
            try {
                FileOutputStream out = new FileOutputStream(path);
                inputStream = myfile.getInputStream();
                byte[] buffer = new byte[8192];
                int bytesRead = 0;
                while ((bytesRead = inputStream.read(buffer, 0, 8192)) != -1) {
                    out.write(buffer, 0, bytesRead);
                }
                out.flush();
                out.close();
            } catch (Exception ex) {
                // handle exception
                ex.printStackTrace();
            } finally {
                try {
                    inputStream.close();
                } catch (IOException e) {
                }
            }

        }
        //Returns the path where file is stored
        return path;
    }
AMImpl method to insert record in table for Uploaded file
 
/**Method to set file path and name
     * @param name
     * @param path
     */
    public void setFileData(String name, String path,String contTyp) {
        ViewObject fileVo = this.getFileUpdDwn1();
        Row newRow = fileVo.createRow();
        newRow.setAttribute("FileName", name);
        newRow.setAttribute("Path", path);
        newRow.setAttribute("ContentType", contTyp);
        fileVo.insertRow(newRow);
        this.getDBTransaction().commit();
        fileVo.executeQuery();
    }
ValueChangeListener to execute all methods 
/*****Generic Method to Get BindingContainer**/
    public BindingContainer getBindingsCont() {
        return BindingContext.getCurrent().getCurrentBindingsEntry();
    }

    /**
     * Generic Method to execute operation
     * */
    public OperationBinding executeOperation(String operation) {
        OperationBinding createParam = getBindingsCont().getOperationBinding(operation);
        return createParam;

    }

    /**Method to Upload File ,called on ValueChangeEvent of inputFile
     * @param vce
     */
    public void uploadFileVCE(ValueChangeEvent vce) {
        if (vce.getNewValue() != null) {
            //Get File Object from VC Event
            UploadedFile fileVal = (UploadedFile) vce.getNewValue();
            //Upload File to path- Return actual server path
            String path = uploadFile(fileVal);
            System.out.println(fileVal.getContentType());
            //Method to insert data in table to keep track of uploaded files
            OperationBinding ob = executeOperation("setFileData");
            ob.getParamsMap().put("name", fileVal.getFilename());
            ob.getParamsMap().put("path", path);
            ob.getParamsMap().put("contTyp", fileVal.getContentType());
            ob.execute();
            // Reset inputFile component after upload
            ResetUtils.reset(vce.getComponent());
        }
    }

سلام عليكم قمت بمحاولة تنفيذ خطوات upload كما موضوع في الاعلي ولكن بعض الاشياء لم توضح الي .حيث نفذت الاتي :

Bean Method to Upload File/1 وقمت بتمريرها الي input file

2/AMImpl method وضعته في AM

3/ ValueChangeListener to execute all methods : لم اعلم اين اضع الكود وهل ساقوم باضفه value change listener لل in putfile  ام ماذا؟

انا استخدم jdev 12c

بتاريخ:

لم أفهم

الرجاء السؤال بطريقة مباشرة عن المشكلة بالضبط

  • بعد 4 أسابيع...
بتاريخ:

هل يوجد امكانيه رفع مثلا 3 ملفات في نفس الوقت

بتاريخ:

نعم

بتاريخ:

ولكن كيف ذلك

بتاريخ:

هذا كود جاهز

يمكن البحث عن multi upload in adf

بتاريخ:

تمام سابحث اذن

بتاريخ:

بالتوفيق

انضم إلى المناقشة

يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.

زائر
أضف رد على هذا الموضوع...

برجاء الإنتباه

بإستخدامك للموقع فأنت تتعهد بالموافقة على هذه البنود: سياسة الخصوصية

Account

Navigation

البحث

إعداد إشعارات المتصفح الفورية

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.