Home » Developer & Programmer » Forms » upload/Copy file using forms 6i. (forms 6i, Database 11g, OS windows server 2012.)
upload/Copy file using forms 6i. [message #677592] Sun, 29 September 2019 01:37 Go to next message
asifcs
Messages: 21
Registered: May 2019
Location: pakistan
Junior Member

HI, Following is my code for copying/uploading a file from client to server machine using forms 6i. works fine for me, only problem is that while I spaces in file name or any folder name having spaces in path it give me error. Please update my code as if there is a space in file name such file could be uploaded/copied.
here is my code.
declare
filename varchar2(500);
filename2 varchar2(500);
v_source_path varchar2(500);
begin
filename := GET_FILE_NAME(DIRECTORY_NAME=>:global.pth,File_Filter=>'PDF FILES (*.pdf)|*.PDF|',dialog_type=>Open_File);
filename2 := substr(filename, (instr(filename,'\',-1,1)+1));
v_source_path := '\\Server-pc\filesData\Attached_Files\ora_files\';
if filename2 is not null then --run only when file select
host('cmd /c copy '||filename||' '||v_source_path||filename2, no_screen);
:profile.Attach_File :=v_source_path||filename2;
if not form_success then
message('Error--Can Not copy Check Path.',no_screen);
message('Error--Can Not copy Check Path.',no_screen);
:profile.attach_file:=null;
else
Message('File Copied Successfully.');
Commit_form;
end if;
end if;

End;
Re: upload/Copy file using forms 6i. [message #677593 is a reply to message #677592] Sun, 29 September 2019 01:53 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

I don't know Forms but as you use a DOS command I can say you have to put the full path file name between double quotes (") to make it work.
So your statement becomes:
host('cmd /c copy "'||filename||'" "'||v_source_path||filename2||'"', no_screen);

Re: upload/Copy file using forms 6i. [message #677594 is a reply to message #677593] Sun, 29 September 2019 01:56 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Also, I'm still waiting for your feedback in your previous topic and I bet others who are helped you in the previous ones are too.

Please read the OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.

Re: upload/Copy file using forms 6i. [message #677596 is a reply to message #677593] Mon, 30 September 2019 00:45 Go to previous message
asifcs
Messages: 21
Registered: May 2019
Location: pakistan
Junior Member

thanks, it works for me.
Previous Topic: Webutil in forms 12c
Next Topic: CALCULATE TIME
Goto Forum:
  


Current Time: Thu Mar 28 09:01:13 CDT 2024