Link to home
Start Free TrialLog in
Avatar of shaza
shaza

asked on

cgi

how can i create a file from cgi?
Avatar of Cynna
Cynna

??

More details please...
Using FileCreate or Rewrite for example.

Regards, Geo
Avatar of shaza

ASKER

i used tfilestream to create a file in harddisk but it didn't work well........
you need to configure your web server to allow
your CGI to access the Hard driver... You will
probably have to create an account and them
assigned to your CGI...

Luis
Avatar of shaza

ASKER

how can i allow my cgi access hard driver?!!!!!!!!
Give us some more details: WebServer type (IIS, PWS, etc.) and that part of your code where you are creating your file.

I use IIS on Win2000/NT4, CGI and ISAPI programs written in Delphi 5 and have no problems accessing the local/remote(LAN) file systems. Paths to local files are given as in any usual (non-CGI) app.

Regards, Geo
Avatar of shaza

ASKER

I use IIS on Win2000, CGI  programs written in Delphi 6
**********
 var
  fname,fpath,str,str1:string;
  {f:file of char} i,FHANDLE:integer;
  f:TFileStream;
  t:text;
begin
   fname:=Request.ContentFields.Values['fname'];
   fpath:=Request.ContentFields.Values['fpath'];
   str:= ''''+fpath+'\'+fname+'''';
   str1:=Request.ContentFields.Values['scbox'];
   assignfile(t,str);
   rewrite(t);
    write(t,'str1');
   close(t);

/////or using filestream
//f:=f.Create(str,fmCreate);
//f.write(str1);
//f.close
   
ASKER CERTIFIED SOLUTION
Avatar of geobul
geobul

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Geo is right about the file name.

I haven't fully read everyone's reply but you need to configure the web server to allow write permissions to the directory where you are wanting to write to the file.  NOTE!  the permissions must allow the anonymous user rights to write.  This is because all CGI applications are executed under the permissions under which the CGI application ran.  In our case I needed to make permissions so the user IUSR_WWW would have Write permissions to our Logs directory...

You may also consider making a tiny app which is super-protected to detect and diagnose any permissions problems.  That can save very much time.  I should have made one much earlier than I did!  It's kind of a "doctor" which verifies that everything necessary works as it should.
shaza:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
shaza,
No comment has been added lately (18 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:

RECOMMENDATION: Award points to geobul http:#7161438

Please leave any comments here within 7 days.

-- Please DO NOT accept this comment as an answer ! --

Thanks,

anAKiN
EE Cleanup Volunteer