You are here
Home > Php > Uploading File using PHP

Uploading File using PHP

Hello Friends, Today I am gonna share PHP code to upload file. I’ve created a function named as upload by which you can upload files on server. The function signature is upload($file, $filesize, $directory, $overwrite).

Here,

$file: name of  input element whose type is file

$filesize: maxium file size to be uploaded

$directory: directory name where file to be uploaded

$overwrite: pass Y to overwrite existing file if already exists or N to generate new file name

To use this function create a file named as upload.php and paste the code, then include upload.php into your code and then use upload function.

Using upload function

Output in Browser

File Upload Output

Thanks

Please share if you like it

Rajesh Kumar Sahanee
I am a passionate Java Developer and I like Computer Programming. I love to do some interesting experiments and listening music in my free time.
https://www.zatackcoder.com

Comments

zatackcoder
Top