The Arcive of vBulletin Modifications Site. |
|
|
#1
|
||||
|
||||
|
Code:
<?php
$username = $_SESSION['MM_Username'];
$times = $_POST['times'];
for ($counter = 1; $counter < $times + 1; $counter++)
{
if ($HTTP_POST_FILES['file$counter']['size'] <= 0)
{
print "<b>File Not Saved</b><BR>";
print "Because your file was over 2 MB, it wasn't recieved.<br>";
}
else
{
$tempFile = $HTTP_POST_FILES['file$counter']['tmp_name'];
$destination = "/****/*******/public_html/photos/$username/" .
$HTTP_POST_FILES['file$counter']['name'];
copy($tempFile, $destination);
print "<b>Your File has been accepted</b><br>";
}
}
?>
'file$counter' has to be in order, such as 1, 2, 3... all the way to the specified number in the $times value. Now, the loop works fine, however, no matter what it won't upload anything. |
|
#2
|
|||
|
|||
|
Does the $username folder exist and is it writable?
And, using copy() it expects to find the $HTTP_POST_FILES['file$counter']['tmp_name'] in the current folder when it is actually buffered in memory and not on disk if I'm reading the functions correcty. |
|
#3
|
||||
|
||||
|
I think you might need to change all instances of this:
PHP Code:
PHP Code:
|
|
#4
|
||||
|
||||
|
--CURRENTLY TESTING ANDREW'S POST--
In my case $username = Red Blaze. And that Directory does exist. I tested it like this: Code:
if ($HTTP_POST_FILES['file1']['size'] <= 0)
{
print "<b>File Not Saved</b><BR>";
print "Because your file was over 2 MB, it wasn't recieved.<br>";
}
else
{
$tempFile = $HTTP_POST_FILES['file1']['tmp_name'];
$destination = "/****/*******/public_html/photos/$username/" .
$HTTP_POST_FILES['file1']['name'];
copy($tempFile, $destination);
print "<b>Your File has been accepted</b><br>";
}
Code:
This is the code in the uploading forms page.
<?php
$times = $_POST['times'];
for ($counter = 1; $counter < $times + 1; $counter++)
{
print "<tr>
<td align=\"right\">File $counter</td>
<td><input name=\"file$counter\" type=\"file\" id=\"file$counter\" /></td>
</tr>";
}
?>
|
|
#5
|
|||
|
|||
|
Quote:
|
|
#6
|
||||
|
||||
|
Thanks - I made that mistake so many times when I first started coding that it's become the first thing I check now when my scripts don't work
|
|
#7
|
||||
|
||||
|
lol Andrew thanks a ton. Now I learned my lesson.
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|