Hi there.
I've spent the weekend getting ever more frustrated, trying to get an
upload file function working on a website.
The site is hosted by a company called oneandone. They're using PHP 4.2.
3, not in safe mode. I think that the basic problem is the set-up for
the temp folder, but I don't have access to the .ini settings.
I'm pretty sure it's possible, because I've got MyPHPAdmin running, and
it's happily accepting uploaded files (although I can't make head nor
tail of their code).
I've read through the manuals online (most of which assume 'it just
sorta works' or that you have access to the .ini files), and I've tried
setting the values for upload_tmp_dir using ini_set() but I just can't
get it to work.
Here's the code I'm stuck with at the moment...
file 1: upload.php
****
<?php
$root = $HTTP_SERVER_VA RS['DOCUMENT_ROOT'];
ini_set('upload _tmp_
dir', $root.'tmp');
?> <html>
<head>
<title>Administ ration - file
upload</title>
</head>
<body>
<h1>Upload new files</h1>
<form
enctype="multip art/form-data" action="upload2 .php" method="post">
<input type="hidden" name="MAX_FILE_ SIZE" value="1000000" >
Upload
this file: <input name="userfile" type="file">
<input type="submit"
value="Send File">
</form>
</body>
</html>
***
file 2: upload2.php
***
<?php
$root = $HTTP_SERVER_VA RS['DOCUMENT_ROOT'];
ini_set('upload _tmp_
dir', $root.'tmp');
?> <html>
<head>
<title>Uploadin g...</title>
</
head>
<body>
<h1>Uploading file...</h1>
<?php
echo 'Document
root is '.$root."<br />\n";
echo 'Upload directory: '.ini_get('uplo ad_
tmp_dir')."<br />\n";
echo 'Upload directory: '.get_cfg_var(' upload_tmp_dir' )."\n";
?>
</body>
</html>
***
(I realise that this doesn't actually do any uploading, but I've rolled
it back as far as I can, as a follower of a walk then run school of
philosophy, just to get it to tell me where it might deign to upload
stuff, were it to work ;-) )
When I execute these two pages, the second page just coughs up a blank
Upload directory, as if it hasn't been set. Can somebody please point
me in the right direction?!?!? My desk is starting to get a forehead
shapped dent in it... I just want to upload some plain text files and a
few 4k jpgs for goodness sake!
Aaarrrgh.
Thanks.
dd
I've spent the weekend getting ever more frustrated, trying to get an
upload file function working on a website.
The site is hosted by a company called oneandone. They're using PHP 4.2.
3, not in safe mode. I think that the basic problem is the set-up for
the temp folder, but I don't have access to the .ini settings.
I'm pretty sure it's possible, because I've got MyPHPAdmin running, and
it's happily accepting uploaded files (although I can't make head nor
tail of their code).
I've read through the manuals online (most of which assume 'it just
sorta works' or that you have access to the .ini files), and I've tried
setting the values for upload_tmp_dir using ini_set() but I just can't
get it to work.
Here's the code I'm stuck with at the moment...
file 1: upload.php
****
<?php
$root = $HTTP_SERVER_VA RS['DOCUMENT_ROOT'];
ini_set('upload _tmp_
dir', $root.'tmp');
?> <html>
<head>
<title>Administ ration - file
upload</title>
</head>
<body>
<h1>Upload new files</h1>
<form
enctype="multip art/form-data" action="upload2 .php" method="post">
<input type="hidden" name="MAX_FILE_ SIZE" value="1000000" >
Upload
this file: <input name="userfile" type="file">
<input type="submit"
value="Send File">
</form>
</body>
</html>
***
file 2: upload2.php
***
<?php
$root = $HTTP_SERVER_VA RS['DOCUMENT_ROOT'];
ini_set('upload _tmp_
dir', $root.'tmp');
?> <html>
<head>
<title>Uploadin g...</title>
</
head>
<body>
<h1>Uploading file...</h1>
<?php
echo 'Document
root is '.$root."<br />\n";
echo 'Upload directory: '.ini_get('uplo ad_
tmp_dir')."<br />\n";
echo 'Upload directory: '.get_cfg_var(' upload_tmp_dir' )."\n";
?>
</body>
</html>
***
(I realise that this doesn't actually do any uploading, but I've rolled
it back as far as I can, as a follower of a walk then run school of
philosophy, just to get it to tell me where it might deign to upload
stuff, were it to work ;-) )
When I execute these two pages, the second page just coughs up a blank
Upload directory, as if it hasn't been set. Can somebody please point
me in the right direction?!?!? My desk is starting to get a forehead
shapped dent in it... I just want to upload some plain text files and a
few 4k jpgs for goodness sake!
Aaarrrgh.
Thanks.
dd
Comment