[ 
https://issues.apache.org/jira/browse/SLING-2499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13287767#comment-13287767
 ] 

Chris Papagrigoriou commented on SLING-2499:
--------------------------------------------

It causes two requests.

Response 1: 
Content modified /content/public/instances
Status  
200
Message         
OK
Location        /public/instances
Parent Location         /public
Path    
/content/public/instances
Referer         http://localhost:8080/index.html
ChangeLog

Response2:
Content modified /content/public/instances
Status  
200
Message         
OK
Location        /public/instances
Parent Location         /public
Path    
/content/public/instances
Referer         http://localhost:8080/index.html
ChangeLog       

created("/content/public/instances/formula.cnf");
created("/content/public/instances/formula.cnf/jcr:content");
modified("/content/public/instances/formula.cnf/jcr:content/jcr:lastModified");
modified("/content/public/instances/formula.cnf/jcr:content/jcr:mimeType");
modified("/content/public/instances/formula.cnf/jcr:content/jcr:data");

Now the file was actually uploaded. It doesn't make any sense.

                
> File Upload with Ajax using the .ajaxForm() Method doesnt work properly
> -----------------------------------------------------------------------
>
>                 Key: SLING-2499
>                 URL: https://issues.apache.org/jira/browse/SLING-2499
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>         Environment: Xubuntu Sling 6
>            Reporter: Chris Papagrigoriou
>            Priority: Critical
>
> The Form: 
> <form  id="fileUploadForm" action="/content/public/instances" method="POST" 
> enctype="multipart/form-data">
> <p><input type="file" name="" id="file" /></p>
> <p><input type="submit" name="upload" id="uploadButton" /></p>
> </form>
> The JavaScript:
> $(document).ready(function() {
>       $("#fileUploadForm").ajaxForm({
>               delegation : true,
>               
>               beforeSubmit : function() {
>                       var fileName = $('#file').val();
>                       fileName = fileName.replace("C:\\fakepath\\", "");
>                       $('#file').attr("name", fileName);
>               },
>               
>               success : function() {
>                       alert("SUCCESS!");
>               }
>               
>       });     
>       
> });
> It works only, if press the submit button twice. At the first click he 
> doesn't create anything. After the second click he uploads the file into 
> /content/public/instances/<filename>
> I tested it with a normal form. Seems I get this problem only when I try to 
> upload the file with ajax.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to