Upload File from Local to Server

To a browse from your local PC and upload the file to the server like the example below:
Under the "Upload File" button Fieldchange event:

-------------------------------------------
Local string &URL_ID = "record://UV_FILE_TMP"; /* Attachment will be stored here temporarily */

&Result = AddAttachment(&URL_ID, &InOutAttachSysfilename, "", &InOutAttachUserfile, &InMaxSize, True);


/* The file will be copied to the /files directory on the App Server */
&file_name = &InOutAttachUserfile;
&temp_dir = "C:\Temp\";

/* Copy file from database record to the files directory */
&Result = GetAttachment(&URL_ID, &file_name, &temp_dir | &file_name);

-------------------------------------------

The UV_FILE_TMP record contains only the subrecord: FILE_ATTDET_SBR

Browse for a file on your local machine.. click on the Upload button on the popup box..

The local file is now on the server and can be processed.

Comments

Post a Comment