|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
I am trying to get an Excel file from a file server to a web server and I am having trouble getting the file to write/copy to a directory on the webserver. I used the UPLOAD_file() with a multipart_form and I am slecting the file but the file does not copy. I am useing the following code.
print $cgi->start_multipart_form( -action=>$action, -name=>"formdata" ),"\n"; print $cgi->filefield(-name=>"sourcefile", -value=>"some_local_directory", -size=>80 ),"\n"; # Second part of the script open (OUTFILE,"> $dest_file"); while ($bitesread=read($sourcefile,$buffer,1024)) { print OUTFILE $buffer or die "can't copy file"; # print "info from file $buffer\n"; } The OUTFILE is being created with 0 bites in it. The directory I am writting to does have the permissions for -RWXRWXRW-. For the group URL that is not the problem. Has anyone used the UPLOAD_FILE() before. Any thoughts would be very welcome...... |
|
#2
|
||||
|
||||
|
Are you uploading this file on a UN*X or WINDOW's server?? Can you upload text files to this server?? As they may have disabled uploads in the CGI.pm($DISABLE_UPLOADS=1). What mime type does the uploadinfo($sourcefile); displays?? I am assume your using the installed CGI.pm module included with Perl,..correct
![]() Code:
open (OUTFILE,"> $dest_file");
while ($bitesread=read($sourcefile,$buffer,1024))
{
print OUTFILE $buffer or die "can't copy file";
# print "info from file $buffer\n";
}
how are you assigning the $dest_file and $sourcefile?? [Edited by mickalo on 01-30-2001 at 11:45 AM]
__________________
Thunder Rain Internet Publishing Custom Programming & Database development Providing Personal/Business Internet Solutions that work! |
|
#3
|
|||
|
|||
|
Yes I am useing the CGI.pm that was installed with perl on a UNIX server(SUN 5.7). I will check with the administrator about the upload flag.
Thank You |
|
#4
|
|||
|
|||
|
Sorry, foprgot a question you wrote.
The $dest_file is defined to a standard name so that another script can use that file name with out change. The $Sourcefile is from $sourcefile=$cgi->param('from_first part_of_the_script'); (A file handle) |
|
#5
|
||||
|
||||
|
If the script isn't too long, post a copy of it here. It appears the problem maybe how your assigning the $dest_file.
Mickalo |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > CGI uploading a file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|