Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old January 30th, 2001, 12:15 PM
dark_jurmanji dark_jurmanji is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Location: Denver, CO
Posts: 0 dark_jurmanji User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 56 sec
Reputation Power: 0
Send a message via ICQ to dark_jurmanji
Angry

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......

Reply With Quote
  #2  
Old January 30th, 2001, 12:37 PM
mickalo's Avatar
mickalo mickalo is offline
Ole` Timer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: N.W. Iowa
Posts: 469 mickalo User rank is Private First Class (20 - 50 Reputation Level)mickalo User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 5 h 19 sec
Reputation Power: 8
Send a message via AIM to mickalo Send a message via MSN to mickalo
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!

Reply With Quote
  #3  
Old January 30th, 2001, 12:50 PM
dark_jurmanji dark_jurmanji is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Location: Denver, CO
Posts: 0 dark_jurmanji User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 56 sec
Reputation Power: 0
Send a message via ICQ to dark_jurmanji
Angry

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

Reply With Quote
  #4  
Old January 30th, 2001, 01:06 PM
dark_jurmanji dark_jurmanji is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Location: Denver, CO
Posts: 0 dark_jurmanji User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 56 sec
Reputation Power: 0
Send a message via ICQ to dark_jurmanji
Angry

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)

Reply With Quote
  #5  
Old January 30th, 2001, 01:16 PM
mickalo's Avatar
mickalo mickalo is offline
Ole` Timer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: N.W. Iowa
Posts: 469 mickalo User rank is Private First Class (20 - 50 Reputation Level)mickalo User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 5 h 19 sec
Reputation Power: 8
Send a message via AIM to mickalo Send a message via MSN to mickalo
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > CGI uploading a file


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway