Home N-13 News Forums Help Search
RegisterForgot password?
How to add image to post necklacesdiscou
Known bugs - 4.0.3 necklacesdiscou

Latest N-13 News 4.0.3

What is N-13 News?
Where can I get help?
Known bugs

Forums Tutorials Simple Upload Form
Calamity
Posted on 22 Apr 2008, 02:12:13

Access: Member
Total Posts: 33
Joined: 2008-04-11


Here is the script.. [Name this upload.php (or w/e)

Code:
<?php 
$target 
= "upload/"; 
$target = $target . basename( $_FILES['uploaded']['name']) ; 
$ok=1; 

//This is our size condition 
if ($uploaded_size > 350000000) 
{ 
echo 
"Your file is too large.<br>"; 
$ok=0; 
} 

//This is our limit file type condition 
if ($uploaded_type =="text/php") 
{ 
echo 
"No PHP files<br>"; 
$ok=0; 
} 

//Here we check that $ok was not set to 0 by an error 
if ($ok==0) 
{ 
Echo 
"Sorry your file was not uploaded"; 
} 

//If everything is ok we try to upload it 
else 
{ 
if(
move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) 
{ 
echo 
"The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; 
} 
else 
{ 
echo 
"Sorry, there was a problem uploading your file."; 
}
}
?>


Then what you wanna do is.. add this script to a page and change the path to the script above...

ALSO-- if you would like to upload files of bigger size change the number found here

Code:

if ($uploaded_size > 350000000)


Code:
<form enctype="multipart/form-data" action="upload.php" method="POST">
<input name="uploaded" type="file" size="30">
<br>
<input type=submit value="Upload">
</form>

to change the size of the text area things mess with the numbers inside size="" [of course the higher the bigger]
----

If you would like this with the password feature.. go back to PHP Tutorials and look for the post called Simple Upload Form

-Tyler
#178
Philip
Posted on 13 May 2009, 11:35:29

Access: Member
Total Posts: 10
Joined: 2009-05-13

how i can add this code to the admin/add new area?
in which page i must add the upload form code?
anyone can help?

thanks!!!
#538
Last edited by Philip at 2009-05-13 11:41:57 Reason:
Network-13.com © 2013