Solved

PHP Upload File Without Form

Posted on 2010-09-01
6
625 Views
Last Modified: 2012-05-10
I need a php script that would be able to upload a file on a pc without a form like this:

ww.mysite.com/upload.php?file=C:\myfile

is this possible?
0
Comment
Question by:XGenwareS
6 Comments
 
LVL 3

Expert Comment

by:aqif_g
ID: 33582990
use POST method to submit form. This will hide URL parametres but work will goes exactly like this.

or use AJAX to send request to a file with these parameters attached. This way your page will not changes and you will remain on the same page.

regards,
aqif
0
 

Author Comment

by:XGenwareS
ID: 33583102
I don't want a form at all. I want just the script to be able to upload it, getting the file name from the url
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 33583331
Isn't going to happen.  PHP running on the server does not have access to your computer.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 3

Expert Comment

by:aqif_g
ID: 33583362
the field you chose to read a file is of type 'file'. When submit that form which contains that file, complete info of file is passed to the page in action. on that page you read all file data using $_FILE.

All values in $_File are set when form is submited. There is no other way to red that.. You can make form submission apearently transparent but you cannot do this without using form.

regards,
aqif  
0
 
LVL 27

Accepted Solution

by:
Lukasz Chmielewski earned 500 total points
ID: 33584707
Not possible. PHP is server - side language, it cannot see anything beside the resident server. Java environment would be able to do this.
0
 
LVL 5

Expert Comment

by:onemadeye
ID: 33585018
well...

if what you tried to approach is ever possible then it would obviously be a serious major security hole.             
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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
It’s a strangely common occurrence that when you send someone their login details for a system, they can’t get in. This article will help you understand why it happens, and what you can do about it.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

920 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

16 Experts available now in Live!

Get 1:1 Help Now