Upload to Folder

Started on the old forum in January 2010 · view the original in the archive · old links redirect here

5 replies · 551 views · started 16 years ago · 1 min read

2 participants
bOrN2pwn Developer · 230 posts #1

Dos any 1 have a simple upload script that simply just uploads a file to a folder on the server no SQL nothing just upload straight to a folder......

Please if any 1 has it or can make 1 it would be much appreciated...... here's my snippet but it's totally wrong.......

<b>Select File To Be Uploaded :</b><br/>
<input align="center" type="file" name="upload"><br/>
<input align="center" type="hidden" name="upload" value="upload"/>
<INPUT align="center" TYPE=SUBMIT NAME="submit" VALUE="Upload File!"><br/><br/></small><br/> <b><u>You can only upload files with folowing extentions:</u></b><br/>
.jpg, .jpeg, .gif, .png, .bmp<br/>
----------

;(

BakGat

class Counter {
public:
  void Count();
  int  ReadDisplay();
private:
  int  CurrentCount;
};

External image (may be gone) External image (may be gone) External image (may be gone)

Back up my hard drive? How do I put it in reverse? http://www.hackthissite.org Profile…

GiLL Senior · 356 posts #2

Note its not secure but you can use for personal use

Overview In this tutorial create 2 files

  1. upload_rename.php
  2. upload_rename_ac.php

Steps

  1. Create file upload_rename.php.
  2. Create file upload_rename_ac.php.
  3. Create folder "upload" for store uploaded files.
  4. CHMOD your upload folder to "777" by using your ftp software(change permission).

Create file upload_rename.php

<table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form action="upload_rename_ac.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td><strong>Single File Upload </strong></td>
</tr>
<tr>
<td>Select file 
<input name="ufile" type="file" id="ufile" size="50" /></td>
</tr>
<tr>
<td align="center"><input type="submit" name="Submit" value="Upload" /></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
</form>

Create file upload_rename_ac.php

<?php

// Your file name you are uploading 
$file_name = $HTTP_POST_FILES['ufile']['name'];

// random 4 digit to add to our file name 
// some people use date and time in stead of random digit 
$random_digit=rand(0000,9999);

//combine random digit to you file name to create new file name
//use dot (.) to combile these two variables

$new_file_name=$random_digit.$file_name;

//set where you want to store files
//in this example we keep file in folder upload 
//$new_file_name = new upload file name
//for example upload file name cartoon.gif . $path will be upload/cartoon.gif
$path= "upload/".$new_file_name;
if($ufile !=none)
{
if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
{
echo "Successful<BR/>"; 

//$new_file_name = new file name
//$HTTP_POST_FILES['ufile']['size'] = file size
//$HTTP_POST_FILES['ufile']['type'] = type of file
echo "File Name :".$new_file_name."<BR/>"; 
echo "File Size :".$HTTP_POST_FILES['ufile']['size']."<BR/>"; 
echo "File Type :".$HTTP_POST_FILES['ufile']['type']."<BR/>"; 
}
else
{
echo "Error";
}
}
?>

left wap stuff

GiLL Senior · 356 posts #4

if i am not mistaken you were user at bdsaint forum site ? few year ago ?

left wap stuff

GiLL Senior · 356 posts #6

na just asking as remember this your nick there i had same nick Gill

left wap stuff

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close