![]() |
IWFileUploader using - Printable Version +- Atozed Forums (https://www.atozed.com/forums) +-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html) +--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html) +---- Forum: English (https://www.atozed.com/forums/forum-16.html) +----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html) +----- Thread: IWFileUploader using (/thread-1434.html) |
IWFileUploader using - MrSpock - 12-16-2019 intraweb 15.1.5 I am looking for a very simple example of uploading one file (png,jpg,gif,bmp). Select file, upload, on upload success, on upload failure. What I have found is too broad and difficult to understand. In particular I need to know how to assign an individual temporary directory for uploaded files for each session so that users should not overwrite other users uploaded files. RE: IWFileUploader using - kudzu - 12-16-2019 IW doesnt save the files using the name of the original files so duplicate file names are ok. IW saves them as temp files and then you as the user choose to save those files with a name you specify if you want to keep the uploads. The demos should show this clearly. RE: IWFileUploader using - MrSpock - 12-16-2019 (12-16-2019, 02:49 PM)kudzu Wrote: IW doesnt save the files using the name of the original files so duplicate file names are ok. IW saves them as temp files and then you as the user choose to save those files with a name you specify if you want to keep the uploads.The demos do not show this clearly. At least I need to know two methods - to choose the file at user's computer and to send the file to server, maybe then to move it from temporary directory to a different one. RE: IWFileUploader using - kudzu - 12-16-2019 Without looking, Im sure the demos MUST save the files as it is the only way. Just change the parameter to whatever you want for the name. http://docs.atozed.com/docs.dll/controls/TIWFileUploader.html RE: IWFileUploader using - kudzu - 12-16-2019 https://github.com/Atozed/IntraWeb/blob/master/XIV/Delphi/FileUploader/Unit7.pas Line 118: // save in the same application directory, with the same name of the original file. Overwrite if it already exists. IWFileUploader5.SaveToFile(FileName, CurDir + FileName, True); The demos DO show exactly as you ask. Just modify the parameter to save wherever you want to save it. RE: IWFileUploader using - MrSpock - 12-17-2019 None of the two web addresses tell anything about methods IWFileUploader1.SelectFile IWFileUploader1.StartUpload which must be used first, as if it was obvious. RE: IWFileUploader using - kudzu - 12-17-2019 Have you run and played with the demo I pointed out? Its fully functional. RE: IWFileUploader using - Jose Nilton Pace - 12-17-2019 Hi, IWFileUpload has propertie: ButtonVisible, it is True?. When you click in his button, they show you to select file, when you selected the file, iwfileupload upload your file automatic. After upload, iwfileupload fire AsyncUploadCompleted. You can create your folder, save your file, etc there. Code: procedure TIWForm.IWFileUploader1AsyncUploadCompleted(Sender: TObject; RE: IWFileUploader using - Alexandre Machado - 12-17-2019 (12-17-2019, 01:59 AM)MrSpock Wrote: None of the two web addresses tell anything about methods IWFileUploader1.SelectFile IWFileUploader1.StartUpload You don't need to select the file and start the upload yourself. These methods have nothing to do with the way the files are saved in the server. You have 2 options to deal with it: Option 1) Implement the event OnAsyncUploadCompleted. Please check out this example and read the comments: Code: procedure TIWForm1.IWFileUploader1AsyncUploadCompleted( Option 2) You can achieve the same thing (without coding the event), if you set IWFileUploader.AutoSavePath property when you create the form (you can only do this at runtime, not at design time): Code: procedure TIWForm1.IWAppFormCreate(Sender: TObject); In the above case, you don't need to do anything else (no need for OnAsyncUploadCompleted event) Just a note: UserCacheDir and everything it contains is deleted by IW application when it terminates. So, after saving the file there you might want to move it to somewhere else (if want to keep it, anyway). RE: IWFileUploader using - MrSpock - 12-21-2019 in procedure TIWForm1.IWFileUploader1AsyncUploadCompleted I change in code label.caption or label.visible but that cannot be seen, form components are not refreshed. What is funny is that components are refreshed in IWFileUploader1AsyncUploadSuccess |