Solved

Saving a binary file (a gif) uploaded from user

Posted on 1998-08-18
8
237 Views
Last Modified: 2010-03-05
I need to give people the chance to upload a picture of themselves and then i need to save it with a name i make up.  The picture would come from their computer, not the net.   I don't have permission to an anonymous ftp for the client. How would I do this, i'd rather not use any modules, i haven't been able to get one working right yet, but if there is no other way fine.  Thanks a lot for the help.
0
Comment
Question by:idadan
8 Comments
 
LVL 5

Expert Comment

by:b2pi
ID: 1204399
Is this supposed to be web based?
0
 

Author Comment

by:idadan
ID: 1204400
yeah,
0
 

Author Comment

by:idadan
ID: 1204401
Adjusted points to 150
0
 
LVL 4

Expert Comment

by:mitek
ID: 1204402
Are you using IIS ? If not, which webserver ?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:idadan
ID: 1204403
apache, its unix, i think,
0
 
LVL 1

Accepted Solution

by:
RoboBob earned 150 total points
ID: 1204404
You can do this using file input, you need a web page that includes a file input in the form...

<FORM METHOD=POST ACTION="$ENV{'SCRIPT_NAME'}" ENCTYPE="multipart/form-data">
File: <INPUT TYPE=FILE NAME=file>
<INPUT TYPE=SUBMIT>
</FORM>

Then you need a perl script that can read in the data from the form, like this:

#!/usr/local/bin/perl -w
use CGI;

$cgi = new CGI;

open(OUT,"> $filename");
while($bytesread = read($cgi->param('file'), $buffer, 1024)) {
    print OUT $buffer;
}
close(OUT);

See the documentation for the CGI module ('perldoc CGI') for more information...
0
 

Author Comment

by:idadan
ID: 1204405
Ok, so filename would be the name that i want to call the file, and where would that get saved to? thanks.
0
 
LVL 1

Expert Comment

by:RoboBob
ID: 1204406
It would get saved whereever you told it to, if you did
$filename = "/tmp/foobar", then it would get saved in the file /tmp/foobar.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now