Help please. I am running a streaming audio server and I need people with a certain user and pass to be able to upload via their browser.
I have the form built and actually tested this on a server with Register Globals on. Everything worked great but, the server I am hosting on has Register Globals off. As a result I have had a heck of a time passing the variables to the page which does the upload. I have read just about everything I can find as far as documentation and have not had any success. Below I have attached the code from both the upload form and the action page. I have tried different methods so you may see some differences. I hope someone can help.
Forgot to add this.
Here is the error I get:string(86) "C:\\Documents and Settings\\jsteidinger\\Desktop\\TEST_UPLOAD_Breaking_Bread_112402.rm"
string(0) ""
string(0) "" Couldn't copy the file.
I have tried both large and small files.
Upload form:
<?
echo '<HTML><HEAD><TITLE>Upload a File</TITLE></HEAD>';
echo '<BODY leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">';
echo '<br><br>';
echo '<table border="2" bordercolor="#000000">';
echo '<tr><td>';
echo '<table align="left" border="0" bgcolor="#CCCCCC"><tr>';
echo '<td><strong><font face="Verdana, Arial, Helvetica, sans-serif" size="1">File to Upload:</font></strong></td></tr>';
echo '<FORM METHOD="GET" ACTION="do_upload2.php" ENCTYPE="multipart/form-data" target="_blank">';
echo '<tr><td><INPUT TYPE="file" NAME="img1" SIZE="25"></td></tr>';
echo '<tr><td><INPUT TYPE="submit" NAME="submit" VALUE="Send File"></td></tr>';
echo '</FORM></table></td></tr></table>';
echo '</BODY></HTML>';
?>
Here is the Action Page:
<?
import_request_variables("G", "up_");
var_dump("$up_img1");
echo '<br>';
var_dump("$up_img1_name");
echo '<br>';
var_dump("$up_img1_size");
if ($up_img1 != "") {
copy("$up_img1", "http://www.lallygag.net/~justin/media/r ... _img1_name")
or die("Couldn't copy the file.");
} else {
die("No input file specified");
}
?>
<HTML>
<HEAD>
<TITLE>Successful File Upload</TITLE>
</HEAD>
<BODY>
<font size="1" face="Verdana, Arial, Helvetica, sans-serif">File has been uploaded
successfully! </font>
<P><font size="1" face="Verdana, Arial, Helvetica, sans-serif">You sent: </font>
<font face="Verdana, Arial, Helvetica, sans-serif" size="1">
<? echo "$up_img1"; ?>
, a</font> <font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<? echo "$_GET['img1_size']"; ?>
byte file with a mime type of
<? echo "$_GET['img1_type']"; ?>
.</font></P>
<font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href="javascript:history.go(-1)">Click
Here to upload another file. </a></font>
</BODY>
</HTML>
Hope someone can help...
REGISTER GLOBALS=off: Variable Handling
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
-
pootergeist
- Forum Contributor
- Posts: 273
- Joined: Thu Feb 27, 2003 7:22 am
- Location: UK
or try var_dump($_FILES)
or - to get used to the reg_glob off address system...
or - to get used to the reg_glob off address system...
Code: Select all
<html> <body> <?php if($_POSTї'done'] == 'yes') { foreach($_FILESї'upload_field_ref'] as $varname=>$varvalue) { echo '$_FILESї''upload_field_ref'']ї''' .$varname. '''] = ' .$varvalue. '<br />'; } } ?> <form method="post" action="<?php echo $_SERVERї'REQUEST_URI']; ?>" enctype="multipart/form-data"> <input type="hidden" name="done" value="yes" /> <input type="file" name="upload_field_ref" /><br /> <input type="submit" value="upload now" /> </form> </body> </html>Well, I read through the documentation you mentioned. I tried several things with the $_FILES. Unfortunately I had no success. Current output part of upload script:
var_dump($_FILES);
echo '<br>';
var_dump($_FILES['img1']);
echo '<br>';
var_dump($_FILES['img1']['name']);
echo '<br>';
var_dump($_FILES['img1']['size']);
Here is the output I recieve:
array(0) { }
string(0) ""
string(8) "['name']"
string(8) "['size']" Couldn't copy the file.
Its like the variable data isnt getting passed correctly.
var_dump($_FILES);
echo '<br>';
var_dump($_FILES['img1']);
echo '<br>';
var_dump($_FILES['img1']['name']);
echo '<br>';
var_dump($_FILES['img1']['size']);
Here is the output I recieve:
array(0) { }
string(0) ""
string(8) "['name']"
string(8) "['size']" Couldn't copy the file.
Its like the variable data isnt getting passed correctly.