Re: WebShop File Upload
Edgars Dzenis
1-9-20
Hi, Lee,

So this part WebFileUpload.hal?action=doupload you can see in the procedure WebFileUpload.
The DoUploadChuck is roughly like this(it's not actual code and won't work, it's just to look at roughly how it works. Hope it helps)

global
function Boolean webup(var string filename,var area rfilearea)

begin
Area FileArea,img,FADone,nFileArea;
Longint enter;
Longint lcnt,pos,spos,epos,pepos;
string 255 tstr,namestr;
boolean getnamef;
Longint namepos,nameepos,i;
string 255 link;
boolean savef;

getnamef = false;
namepos = 0;
nameepos = 0;

savef = true;
WebGetRawPostData(rFileArea);
//ReplaceWebStrings(nFileArea,rfilearea);

savef = true;


webup = savef;
return;
end;


global
updating procedure chunkup(string sess,string fn,var string nename)
begin

CreateFolder("tmp/" & sess);
CreateFile("tmp/" & sess & "/" & fn & ".tmp");
nename = fn & ".tmp";


return;
end;

global

updating procedure chunkupchunk(string sess,string fn,var area tarea)
begin

AppendAreaToFile("tmp/" & sess & "/" & fn,tarea);

return;
end;


global
updating procedure chunkupfinish(string sess,string tmpname,string fn)
begin
string 255 folder;

folder = "tmp/" & sess;
RenameFile(folder & "/" & tmpname,folder & "/" & fn);

return;
end;

global
procedure HandleFileUploadFinish(string sess)
begin
string 255 path,filename,id,tag;


switch (tag) begin
case "test":
if (FileExists("tmp/" & tag & "/" & sess)) then begin
RenameFile("tmp/" & tag & "/" & sess,"tmp/" & tag & "/" & filename);
end;
end;


path = "tmp/" & tag & "/" & sess;
if (FileExists(path)) then begin
Delete_File(path);
end;

return;
end;

global
procedure WebDoUploadChunk()
begin
string 255 filename,foldername,tname;
String 255 server_uuid,server_addr,server_port,country,product,localizations;
Integer oldcomp,cc;

area tarea;
record CUVc CUr;
BOolean succf;

switch (WebGetArg("type")) begin
case "start":
qupdating.chunkup(GetWebSessionUUID,WebGetArg("filename"),filename);
PutSessionString("temp_upload_filename",filename);
PutSessionString("temp_upload_filename2",WebGetArg("filename"));
case "file":
webup(tname,tarea);
qupdating.chunkupchunk(GetWebSessionUUID,GetSessionString("temp_upload_filename"),tarea);
case "end":
qupdating.chunkupfinish(GetWebSessionUUID,GetSessionString("temp_upload_filename"),GetSessionString("temp_upload_filename2"));
product = "test";


foldername = "tmp/" & GetWebSessionUUID;
WebOutString("");
end;

return;
end;
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
Yavuz Yigiterhan
More explanation @Paul: When the issue occurs, should see if restarting presence or lookup helps. If so - that is the issue and should be sorted. First need to ensure that that is the issue...
07:18 2 July 2025
Arzu Erdogdu
Hello! You can mark it as closed as option. If document is connected with other documents you can not delete it so you will not be able to delete PO, as you will not be able to remove Goods receipt...
09:29 13 Jun 2025