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
Piotr Wycichowski
Thanks Gatis, anyway it seems to be reported as bug instead of wish because now it depends on who created task for whom, am I right? /Piotr W....
14:39 15 May 2024
Aldevinas Katkus
Actually a new version of this bug is SL>>Reports>>Periodic customer statement "accumulates" amounts Not sure why it was duplicated, I clicked "submit"only once....
08:09 10 May 2024