Advertisement

05.25.2008 at 02:09PM PDT, ID: 23431614
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.4

File Upload in Perl

Asked by jpking72 in Perl Programming Language

Tags:

I'm trying to upload a resume from my local computer into a database.  When I run the script below i get a "bad file descriptor".  Recently I transferred the project from "test.mysite.com" to "mysite.com" and trashed the old project at mysite.com.  The previous file had an upload in it and it worked fine, but I am using the same code now and it doesn't work.  I think it might have something to do with the ".htaccess" file but I deleted and it still didn't work.  The reason I say this is because the error log in perl was giving me an error in my upload directory.  It was looking in the "restricted" directory of "mysite.com".  I no longer have a restricted directory but for some reason my server thinks that it I do.  Confusing I know, ask me to clarify if necessary.  
What is happening now is it is creating the file on the server in the upload directory but its size is "0"....thanks in advance.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
#!/usr/bin/perl
 
use strict;
use warnings;
use DBI;
use CGI;
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);  # remove this when script goes into #production
use File::Basename;
 
my $cgiobj = new CGI;
 
print $cgiobj->header; 
 
my %formdata = $cgiobj->Vars;
#================= UPLOAD FILE ============================
 
my $uploaddir = "/home/test.mysite.com/uploads";
 
my $filename = $cgiobj->param("resume");
 
$filename =~ s/.*[\/\\](.*)/$1/;
 
my $uploadfilehandle = $cgiobj->upload("resume") or die "$!";
 
open UPLOADFILE, ">$uploaddir/$filename";
 
binmode UPLOADFILE;
 
while ( <$uploadfilehandle> )
{
   print UPLOADFILE;
}
 
close UPLOADFILE;
[+][-]05.25.2008 at 05:32PM PDT, ID: 21644100

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Perl Programming Language
Tags: Perl
Sign Up Now!
Solution Provided By: ozo
Participating Experts: 1
Solution Grade: B
 
 
[+][-]05.25.2008 at 05:52PM PDT, ID: 21644166

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.25.2008 at 06:56PM PDT, ID: 21644308

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628