C#/.NET - Jquery File Upload and Backload, show files already uploaded and register with form

119 views
Skip to first unread message

Eric Harms

unread,
Aug 22, 2014, 11:38:50 AM8/22/14
to jquery-f...@googlegroups.com
Hello,

Using Backload & Jquery File Upload.

I have a table, with a list of entries.  Each get their own file upload.

I can upload each just fine (multiple instances of the jquery file upload form) however I can't figure out how to load the download template on page load and populate each upload form with the name of the item from the database, and the link to delete the file on the delete button.

I have not changed anything in the default download template.

Code:

<form class="fileupload" action="/Uploads/UploadImage" method="POST" enctype="multipart/form-data">
    <noscript><input type="hidden" name="redirect" value="/"></noscript>
    <div class="existingFile">@t.TrackFileName</div>
    <div class="row fileupload-buttonbar">
        <div class="span7">
            <span class="btn btn-default fileinput-button">
            <span class="glyphicon glyphicon-plus"></span>
            <input type="file" name="files[]">
            </span>
            <button type="button" class="btn btn-default delete">
            <span class="glyphicon glyphicon-trash"></span>
            </button>
            <span class="fileupload-loading"></span>
        </div>
        <div class="span5 fileupload-progress fade">
            <div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100">
                <div class="bar" style="width:0%;"></div>
            </div>
            <div class="progress-extended">&nbsp;</div>
        </div>
    </div>
    <table role="presentation" class="table table-striped"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody></table>           
    @Html.Hidden("ProductId", @t.ProductId)
</form>


this is how the delete button is rendered after uploading a file, and jquery file upload shows the download template

<button class="btn btn-danger delete" data-type="DELETE" data-url="http://localhost:50332/Uploads/UploadImage?fileName=background9.mp3">
<i class="icon-trash icon-white"></i>
<span>Delete</span>
</button>

i can add the data-url to my delete button, i can then hit the controller method and register the handler.DeleteFilesRequestStarted += handler_DeleteFilesRequestStarted handler, however i am returned a blank screen with 

{"files":[]}

as if the file name was not being posted.

I think i need to somehow check if there is a file uploaded, and then tell jquery file upload that I want to show the download template for that particular entry.

Thanks in advance for your help
Reply all
Reply to author
Forward
0 new messages