NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

You can create file upload functionality by using PHP. Initially files are uploaded into a temporary directory of web server and then relocated to a target destination folder by a PHP function.

File upload parameters, i.e. upload_tmp_dir, upload_max_filesize are default set into PHP configuration file php.ini.

Create an HTML Upload-File Form
<form action="" method="post" enctype="multipart/form-data" name="form1">
<input type="file" name="resume" id="resume">
<input type="submit" name="SubmitBtn" id="SubmitBtn" value="Upload Resume">
</form>
HTML form attribute (enctype=’multipart/form-data‘) is required to upload a file.
Creating an PHP File Upload Script
<?php
ifisset($_POST["SubmitBtn"])){

$fileName=$_FILES["resume"]["name"];
$fileSize=$_FILES["resume"]["size"]/1024;
$fileType=$_FILES["resume"]["type"];
$fileTmpName=$_FILES["resume"]["tmp_name"];

if($fileType=="application/msword"){
if($fileSize<=200){

//New file name
$random=rand(1111,9999);
$newFileName=$random.$fileName;

//File upload path
$uploadPath="testUpload/".$newFileName;

//function for upload file
if(move_uploaded_file($fileTmpName,$uploadPath)){
echo "Successful";
echo "File Name :".$newFileName;
echo "File Size :".$fileSize." kb";
echo "File Type :".$fileType;
}
}
else{
echo "Maximum upload file size limit is 200 kb";
}
}
else{
echo "You can only upload a Word doc file.";
}
}
?>
By using the PHP global $_FILES array you can upload file from a client computer to the web server.
• $_FILES[“file”][“name”] – uploaded file name
• $_FILES[“file”][“type”] – uploaded file type
• $_FILES[“file”][“size”] – uploaded file size in bytes
• $_FILES[“file”][“tmp_name”] – uploaded file temporary file name
• $_FILES[“file”][“error”] – the error code resulting from the file upload
Saving the Uploaded File
The examples above create a temporary copy of the uploaded files in the PHP temp folder on the web server and then PHPmove_uploaded_file() function relocate uploaded file from temp directory to a our target destination.
The temporary copied file auto deleted when the script execution ends.


Thumbnail
function make_thumb($src, $dest, $desired_width) {

/* read the source image */
$source_image = imagecreatefromjpeg($src);
$width = imagesx($source_image);
$height = imagesy($source_image);

/* find the "desired height" of this thumbnail, relative to the desired width */
$desired_height = floor($height * ($desired_width / $width));

/* create a new, "virtual" image */
$virtual_image = imagecreatetruecolor($desired_width, $desired_height);

/* copy source image at a resized size */
imagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0, $desired_width, $desired_height, $width, $height);

/* create the physical thumbnail image to its destination */
imagejpeg($virtual_image, $dest);
}




For more details please visit

https://code.tutsplus.com/articles/how-to-dynamically-create-thumbnails--net-1818
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.