I'm almost able to do my file uploading. I reverted to using Simon Tneoh's file uploading script but I'm getting an error I'm not sure what it is about (I may be a bit over my head with all this...). So, there's a call to a method called $fu->save_as($filename); and it returns the error "Bad file descriptor"; The whole script is the following (sorry if this is a bit long) with the save_as() sub giving the error :

package FileUpload;

use strict; use IO::Handle; use IO::File; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);

Re: Almost there, just an error I don't know what it is about
[In reply to]

Can't Post

I guess that could be it. I tried some other forms of uploading and it seemed to be around the opening of a file on my computer that bugs appeared... Are there some issues I'm not aware of to be able to open a file on my computer for uploading? Special security that scripts tend to enforce? If I can go past that, I should be home free (and even use the simplified upload script from Anthony et al. from a couple of posts back). So, is there a way to find more specific errors about this to guide me (or my wonderful friends here...) or to go over the errors I get? Much thanks!

dwsDeleted

Oct 11, 2000, 10:32 AM

Post #4 of 8
(6205 views)

Re: Almost there, just an error I don't know what it is about
[In reply to]

Can't Post

I just noticed that you're using fdopen(). Look it up, and compare it with open(). Then decide which one you need.

Re: Almost there, just an error I don't know what it is about
[In reply to]

Can't Post

Ok, I changed it to open() since the error was about a bad file descriptor, which is what fileno() was about. Now, I get another error : Can't locate auto/IO/Handle/open.al in @INC

Does it seem there's a module missing from the Perl installation? The script is using IO::Handle and IO::File modules. Does anyone know if the missing open.al belongs to either one of those or to another one? If someone knows what this error leads to, lemme know. Thanks again!

p.s.: if someone is willing to write me or give me a working script to upload that's easy to use, I'd be eternally grateful. If you'd be able to help me get it running ok, I'd be doubly eternally grateful!

[This message has been edited by Merlin (edited 10-11-2000).]

dwsDeleted

Oct 11, 2000, 9:44 PM

Post #6 of 8
(6205 views)

Re: Almost there, just an error I don't know what it is about
[In reply to]

Can't Post

You're too close to give up.

Hint: Does IO::Handle contain the implemention of open() that you need for opening a file, or is there perhaps a subclass of IO::Handle that has the right implementation.

Re: Almost there, just an error I don't know what it is about
[In reply to]

Can't Post

I had a lot of trouble with an uploading script that I was making today and yesturday, I always knew I would have to learn how to actually make an upload utility myself someday so I didn't have to rely on scripts I don't fully understand. Then when I was givin this script I learned that it's not all that difficult.

###################################################################### #Copyright 1998 David Turley (dturley@pobox.com> #Last Modified April 30, 1998 #This script may not be resold or distributed without the author's #express written permission. #The current version of the script is available at #http://www.pobox.com/~dturley/script.html ######################################################################

##################### DESCRIPTION ############################## #This script allows users to upload files to a predetermined #directory on your server. After a successful upload, email is #sent to the adminstrator informing of an uploaded file. # #You must have the CGI.pm module installed. This module is distributed #with recent Perl distributions. Info on the module can be found at: # http://www.genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html

######################## SETUP ################################# # Enter the correct values for these variables below: # # $mailTo -- This is the email address to which email notification of # an upload will be sent. # # $upload_dir -- The directory where uploaded files will be saved. # # You may use either sendmail or the Net::SMTP module to send email: # To use sendmail, set $use_sendmail = "yes", # To use Net::SMTP module, set $use_sendmail = "no". # $mail_path -- The path to your sendmail program. # OR # $mail_server -- Use this variable if you aren't using sendmail. # Note: you can comment out the unused mail variable. # # %PASSWORDS -- Set names and paswords for valid users here. Be sure # to follow proper syntax. # # #Upload the script and set proper permissions for your server. There #is no separate HTML form to upload. All forms are generated by this #script. To access the upload form, enter the URL for the script in #your web browser.

######################## BEGIN SETUP ################################# use CGI qw/:standard :html3/; use Net::SMTP; ##comment out if not using

$mailTo = 'you@youremail.com';

$upload_dir = '/www/your/directory/';

$use_sendmail = 1; #set to 1 to use sendmail, 0 to use Net::SMTP module

Re: Almost there, just an error I don't know what it is about
[In reply to]

Can't Post

Thanks for the info. I really think that the bug is the opening of the file at my end, on my computer. I tried another script using some standard file parsing and nothing's uploaded. I get, as I did numerous times before, a 0 bytes long file with the correct filename. I always knew I needed the enctype="multipart/form-data" form field and always used it. Does anyone know why the various scripts can't open the file on my computer? I turned off my BlackIce Defender just in case since it bloacked a lot of stuff I did on the net. Are there any calls I could make in the various scripts that could enlighten me as to why the failed upload? Thanks in advance.

p.s.: I'm using this script on a SSL server, could this have something to do with it?