Link to home
Start Free TrialLog in
Avatar of cemaykan
cemaykan

asked on

setting upload file's location

Hi,

From a web page that I have created, I am trying to upload a file and put it into a specific location in my computer.


how can I set a location for this uploading process "for example under c:/...." what is the source code look like?

right now, I am using windows OS

thank you in advance

cem
Avatar of ahoffmann
ahoffmann
Flag of Germany image

the web server cannot set the path on the client
you only can try to use client-side scripting, like JavaScript, ActiveX etc.
Avatar of Tintin
Tintin

For upload, I think you really mean download.  Upload means sending a file from your computer up to the webserver.  Download is the opposite.

Anyway, ahoffman has already answered your question (unless you really did mean upload)
Avatar of cemaykan

ASKER

I am sorry for the misunderstanding about my question. Let me explain what I am doing in more detail.

I have created a webpage, and I have a server working behind it.

The users logged into that page,
the page is:
<HTML>
<HEAD>File Upload</HEAD>
<BODY>
<FORM ACTION="upload2.cgi" METHOD="post" ENCTYPE="multipart/form-data">
File to Upload: <INPUT TYPE="file" NAME="files"> <br><br>
<INPUT TYPE="submit" NAME="Submit" VALUE="Upload File">
</FORM></BODY></HTML>

and send their files to the server.

#!/usr/bin/perl
use CGI;
$q = new CGI;
$file = $q->param('files');
print $q->header;
mkdir "$file";
print "File name is: $file";

This code uploads the file to the same place where the .cgi file is, right?

My question is, how can I set the files location to somewhere else? for ex. it is under a directory called perl_project, but I want to move it to a directory with the path C:/uploaded_files/

Sorry again for the undetailed question.

thank you

cem
 

   

$file = 'C:/uploaded_files/ ' . $file;
ASKER CERTIFIED SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
hello cem
Im doing the similar thing writing a perl script to upload it to the server
but Im stuck with upload.pl
howz ur upload.pl working?
ronan_40060, this question deals with a form provided by the web server, no script on the client