By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,423 Members | 2,466 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,423 IT Pros & Developers. It's quick & easy.

PHP and file uploads

P: n/a
Hi All,

Here's one thing that I don't know much about - file uploading. As part of
my project, I will have to build a file manager of sorts - perhaps a
document manager. Anyhow, this involves allowing my user to upload files to
a location.

I know PHP can do it - I know this because it sure does everything else ...
but I don't know this from any authoritative source.

So ... can you tell me if PHP can handle files uploads, and if so, what are
the drawbacks that you might have learned of in your experience? For
instance, in the ASP world, using a COM object for the upload works, but
apparently has significant impact on performance.

So anyway, advise (advice???) me ...

Thanks,
Santosh
Jul 17 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
"OneSolution" <on*********@jatakainc.com> wrote in message
news:IG*********************@newssvr11.news.prodig y.com...
Hi All,

Here's one thing that I don't know much about - file uploading. As part of my project, I will have to build a file manager of sorts - perhaps a
document manager. Anyhow, this involves allowing my user to upload files to a location.

I know PHP can do it - I know this because it sure does everything else .... but I don't know this from any authoritative source.

So ... can you tell me if PHP can handle files uploads, and if so, what are the drawbacks that you might have learned of in your experience? For
instance, in the ASP world, using a COM object for the upload works, but
apparently has significant impact on performance.

So anyway, advise (advice???) me ...

Thanks,
Santosh


It's really easy, just use the right form field, and be sure to copy it to a
location. Remember, it is a temp file until you copy it somewhere. This
means it is gone once your script has finished.

$filename=$HTTP_POST_FILES['file']['name'];
$uploadedtempfile=$HTTP_POST_FILES['file']['tmp_name'];
$newfilepath="WHATEVER";
copy ($uploadedtempfile, $newfilepath);

Regards
Richard Grove

http://shopbuilder.org - ecommerce systems
Become a Shop Builder re-seller:
http://www.affiliatewindow.com/affil...ls.php?mid=611
http://www.affiliatewindow.com/a.pl?590

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.536 / Virus Database: 331 - Release Date: 03/11/2003
Jul 17 '05 #2

P: n/a
"Richard Grove" <info[at]redeyemedia[dot]co[dot]uk> wrote in
news:3f*********************@mercury.nildram.net:
"OneSolution" <on*********@jatakainc.com> wrote in message
news:IG*********************@newssvr11.news.prodig y.com...
Hi All,

Here's one thing that I don't know much about - file uploading. As
part

of
my project, I will have to build a file manager of sorts - perhaps a
document manager. Anyhow, this involves allowing my user to upload
files

to
a location.

I know PHP can do it - I know this because it sure does everything
else

...
but I don't know this from any authoritative source.

So ... can you tell me if PHP can handle files uploads, and if so,
what

are
the drawbacks that you might have learned of in your experience? For
instance, in the ASP world, using a COM object for the upload works,
but apparently has significant impact on performance.

So anyway, advise (advice???) me ...

Thanks,
Santosh


It's really easy, just use the right form field, and be sure to copy
it to a location. Remember, it is a temp file until you copy it
somewhere. This means it is gone once your script has finished.

$filename=$HTTP_POST_FILES['file']['name'];
$uploadedtempfile=$HTTP_POST_FILES['file']['tmp_name'];
$newfilepath="WHATEVER";
copy ($uploadedtempfile, $newfilepath);

Regards
Richard Grove

http://shopbuilder.org - ecommerce systems
Become a Shop Builder re-seller:
http://www.affiliatewindow.com/affil...ls.php?mid=611
http://www.affiliatewindow.com/a.pl?590

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.536 / Virus Database: 331 - Release Date: 03/11/2003


You could think about using PEAR http upload, which I found useful.

VonHeler
Jul 17 '05 #3

P: n/a
Von Heler <vo******@hotmail.com> wrote in
news:Xn**********************@130.133.1.4:
"Richard Grove" <info[at]redeyemedia[dot]co[dot]uk> wrote in
news:3f*********************@mercury.nildram.net:
"OneSolution" <on*********@jatakainc.com> wrote in message
news:IG*********************@newssvr11.news.prodig y.com...
Hi All,

Here's one thing that I don't know much about - file uploading. As
part

of
my project, I will have to build a file manager of sorts - perhaps a
document manager. Anyhow, this involves allowing my user to upload
files

to
a location.

I know PHP can do it - I know this because it sure does everything
else

...
but I don't know this from any authoritative source.

So ... can you tell me if PHP can handle files uploads, and if so,
what

are
the drawbacks that you might have learned of in your experience? For
instance, in the ASP world, using a COM object for the upload works,
but apparently has significant impact on performance.

So anyway, advise (advice???) me ...

Thanks,
Santosh


It's really easy, just use the right form field, and be sure to copy
it to a location. Remember, it is a temp file until you copy it
somewhere. This means it is gone once your script has finished.

$filename=$HTTP_POST_FILES['file']['name'];
$uploadedtempfile=$HTTP_POST_FILES['file']['tmp_name'];
$newfilepath="WHATEVER";
copy ($uploadedtempfile, $newfilepath);

Regards
Richard Grove

http://shopbuilder.org - ecommerce systems
Become a Shop Builder re-seller:
http://www.affiliatewindow.com/affil...ls.php?mid=611
http://www.affiliatewindow.com/a.pl?590

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.536 / Virus Database: 331 - Release Date: 03/11/2003


You could think about using PEAR http upload, which I found useful.

VonHeler


http://pear.php.net/package/HTTP_Upload
Jul 17 '05 #4

P: n/a
On Mon, 24 Nov 2003 07:45:44 GMT, "OneSolution"
<on*********@jatakainc.com> wrote:
So ... can you tell me if PHP can handle files uploads, and if so, what are
the drawbacks that you might have learned of in your experience? For
instance, in the ASP world, using a COM object for the upload works, but
apparently has significant impact on performance.


PHP does file uploads - but you need to check the server is configured
to allow it easily. The upload methods built into the language can be
turned off in the PHP configuration file on the server.

If you are running in some kind of "safe" environment where the upload
facility has been switched off, you can usually get around it by
opening an FTP connection and sending the various FTP commands (which
works really well actually).
kafooey
- ka*****@nospam.yahoo.co.uk
- http://www.pluggedout.com/blog
Jul 17 '05 #5

P: n/a
"OneSolution" <on*********@jatakainc.com> wrote in message news:<IG*********************@newssvr11.news.prodi gy.com>...
Hi All,

Here's one thing that I don't know much about - file uploading. As part of
my project, I will have to build a file manager of sorts - perhaps a
document manager. Anyhow, this involves allowing my user to upload files to
a location.

I know PHP can do it - I know this because it sure does everything else ...
but I don't know this from any authoritative source.

So ... can you tell me if PHP can handle files uploads, and if so, what are
the drawbacks that you might have learned of in your experience? For
instance, in the ASP world, using a COM object for the upload works, but
apparently has significant impact on performance.

So anyway, advise (advice???) me ...


1. Use Google ( http://www.google.com/search?q=file+upload+PHP )
2. Use php.net (
http://www.google.com/search?q=file+...ww%2Ephp%2Enet )

---
"Dying is an art, like everything else"---Sylvia Plath
Email: rrjanbiah-at-Y!com
Jul 17 '05 #6

P: n/a
Regarding this well-known quote, often attributed to OneSolution's famous
"Mon, 24 Nov 2003 07:45:44 GMT" speech:
Hi All,

Here's one thing that I don't know much about - file uploading. As part of
my project, I will have to build a file manager of sorts - perhaps a
document manager. Anyhow, this involves allowing my user to upload files to
a location.

I know PHP can do it - I know this because it sure does everything else ...
but I don't know this from any authoritative source.

So ... can you tell me if PHP can handle files uploads, and if so, what are
the drawbacks that you might have learned of in your experience? For
instance, in the ASP world, using a COM object for the upload works, but
apparently has significant impact on performance.

So anyway, advise (advice???) me ...

Thanks,
Santosh


The only drawback of PHP uploading is that the entire file(s) needs to be
uploaded before PHP processes, which rules out things like progress bars
and stopping invalid uploads early.

There's a PERL-to-PHP sort of snap-in for this that someone's made, but I
don't recall the URL (anyone?).

--
-- Rudy Fleminger
-- sp@mmers.and.evil.ones.will.bow-down-to.us
(put "Hey!" in the Subject line for priority processing!)
-- http://www.pixelsaredead.com
Jul 17 '05 #7

P: n/a
FLEB <so*********@mmers.and.evil.ones.will.bow-down-to.us> wrote in message news:<1g*******************************@40tude.net >...
Regarding this well-known quote, often attributed to OneSolution's famous
"Mon, 24 Nov 2003 07:45:44 GMT" speech:
Hi All,

Here's one thing that I don't know much about - file uploading. As part of
my project, I will have to build a file manager of sorts - perhaps a
document manager. Anyhow, this involves allowing my user to upload files to
a location.

I know PHP can do it - I know this because it sure does everything else ...
but I don't know this from any authoritative source.

So ... can you tell me if PHP can handle files uploads, and if so, what are
the drawbacks that you might have learned of in your experience? For
instance, in the ASP world, using a COM object for the upload works, but
apparently has significant impact on performance.

So anyway, advise (advice???) me ...

Thanks,
Santosh


The only drawback of PHP uploading is that the entire file(s) needs to be
uploaded before PHP processes, which rules out things like progress bars
and stopping invalid uploads early.

There's a PERL-to-PHP sort of snap-in for this that someone's made, but I
don't recall the URL (anyone?).


http://www.google.com/search?q=php+upload+progress

---
"Dying is an art, like everything else"---Sylvia Plath
Email: rrjanbiah-at-Y!com
Jul 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.