Re: WebShop File Upload
Nejc R.
1-14-20
Hello,

This example is used with XHR for asynchronous upload.

The "start" part is just to receive the filename and create the file, setup session, setup loading bar on the webpage etc. It's just a normal ajax call to the server to make sure everything is set up.
$.get("/WebFileUpload.hal?action=start&session=" + session + "&newname=" + newname + "&filename=" + filename,function(data){...});

"file" is the only place where XHR is actually used. The way this is setup it can handle breaking up larger files and uploading them as parts
if you want the upload to actually work in blocks you need to handle breaking the file apart in JavaScript and send piece by piece with XHR, the server-side code will just append everything it gets to the file.
xhr.open('POST', "/WebFileUpload.hal?action=file&session=" + session + "&tmpname=" + tmpname +"&fn=" & fn, true);

"end" is also just a standard ajax call to finalize upload, move file to proper location, delete the temporary one and clean up the loading bar on the webpage.
$.get("/WebFileUpload.hal?action= end&session=" + session,function(data){...});


Leave Comment
You can subscribe to notifications for this post by selecting the 'star' icon on the top right corner of the post.
Latest Posts
Hello, Kindly please report the bug so that we can further investigate and resolve it. Thank you. Best regards, Benjamin...
11:31 3 May 2024
Hi, No changes should have been made that would increase client's HDB file. Please try to delete HANSA.HDB from client folder and reconnect to server and check if it will grow to 30MB again. ...
10:14 30 Apr 2024