[
https://issues.apache.org/jira/browse/SLING-2499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13287746#comment-13287746
]
Felix Meschberger commented on SLING-2499:
------------------------------------------
So, you have to click twice: Does this cause two requests ? Or is the Ajax
request only sent with the second click ?
If it is only sent with the second click, this has something to do with your
client-side form setup.
> 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