473,546 Members | 2,249 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to upload an Image file using perl scripting?

9 New Member
Hi All,

I would like to upload a image file from my web page to the server using perl scripting.

Please, if any one knows regarding this or has the source code for the same, please help me out.

Any information on this topic will be appreciated.

Thanks And Regards,
Prakhar
Jan 23 '07 #1
2 4287
geek491
21 New Member
#!C:/Perl/bin/perl
use CGI;
use DBI;

my $co = new CGI;
my $file_name;

if(!$co->param())
{

print $co->header();
print $co->start_html() ;
print $co->start_multipar t_form;
print $co->filefield(-name=>'filename ', -size=>30);
print $co->submit(-value=>'UPLOAD FILE');
print $co->end_form();

}
else
{
print $co->header();
print $co->start_html() ;
$file = $co->param('filenam e');
@data = <$file>;
print @data;
}
#attach_file();
#$path_name = $co->param('pathnam e');
#@temp=split(/\\/,$path_name);
#$file_name = pop(@temp);
#$server_path=' ./documents/'.$file_name;

#print "Content-Disposition: attachment; filename = $file_name\n\n" ;
#print $co->header('applic ation/x-octet-stream');

#$uploaded_file ='/cgi-bin/documents/'.$file_name;
#print "<a href=download.p l>$file_name</a>";
#print $co->redirect('atta ch.html');


sub attach_file
{
open(INFILE,"$p ath_name");
open (OUTFILE,">$ser ver_path");
binmode(INFILE) ;
binmode(OUTFILE );

while (read($path_nam e,$buffer,1024) )
{
print OUTFILE $buffer;
}
print "Successful ly attached....";
close (INFILE);
close (OUTFILE);
}


instead of writing the file to the browser write it some location.... it will be similar to uploading.
Jan 23 '07 #2
KevinADC
4,059 Recognized Expert Specialist
Search script archives such as www.hotscripts.com for "file uploader" scripts or some similar description.
Jan 23 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2360
by: Paul Hamlington | last post by:
Hello, I've been programming in ASP for a little while now and quite an advanced user, but I have come across an unusual problem in which I need assistance. I have built my own image upload, I have two versions of the binary to string conversion one fast, one slow because some servers use chillisoft and therefore the append function in...
1
2711
by: DavidA | last post by:
I have a very simple form and perl script that is to upload a jpg file. I am not familiar with the perl language but copied the code from a text book. It works fine with all browsers except IE. !!!!! The code is able to validate that it is a jpg but never gets to the debugging statement 'in loop" I have seen numerious complaints via...
1
2581
by: G | last post by:
Hello Friends How are you? I came with a problem near you. I want to upload a image to my ftp, iam getting this below error. i have a code which is working in my local system, i have an idea that we need to provide permissions to upload(like username password) but where we have to provide those details can you please tell me. Microsoft...
2
3182
by: prakharv | last post by:
Hi All, I would like to upload an image file from my web page to the server using C(CGI scripting). Actually I am able to upload a text file using gcgi library but not image file. Please, if any one knows regarding this or has the source code for the same, please help me out. Any information on this topic will be appreciated. Thanks...
9
3880
by: Steve Poe | last post by:
I work for an animal hospital trying to use PHP to store an animal's dental x-rays to a file server. I can browse for the xray on the local desktop computer then click "Upload Image". This works fine. The doctors want fewer steps to follow. So, it was asked if I can configure the browser to load/submit the image 'xray.tif' each time they...
21
34349
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready...
18
34683
jhardman
by: jhardman | last post by:
Have you ever wanted to upload files through a form and thought, "I'd really like to use ASP, it surely has that capability, but the tutorial I used to learn ASP didn't mention how to do this."? Have you looked around trying to find simple solutions but didn't want to wade through pages of complex code? Have you balked at paying for premade...
1
2111
by: fortwilliam | last post by:
Hi, I am very new to "object oriented programming". I have this script which I didn't write but have altered and have been using for a while to allow people to upload files to a website. Now I am trying to adapt the same script to upload files to multiple websites specified in an array. This is for a content management system for our websites. I...
1
5705
by: achotto | last post by:
hi, i try to upload a multiple image files. after that i will rename the files name. the problem is when i upload a 2 or more same files name exp-goal.jpg, it will return "files already exist". ok this is my codes, Set Upload = Server.CreateObject("Persits.Upload.1") Count = Upload.Save("d:\cmsupload\cimg\") for each File in upload.Files...
0
7694
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7947
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7461
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6026
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5360
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1921
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.