Wednesday, 26 February 2014

Uploading the User profile Image Function

Although I have already developed the code to be able to click and open the users file window and select a file the function is not fully finished. I am missing the PHP code that processes the action and embeds the image onto the website.

Below is the HTML form


I created a php file called processimageupload.php were the function of the upload will be stored and saved. Within this file I need to specify the directory of the database and the location where the files will be contained. The tutorial I used as a guideline covers various sections although I need to read up on various features it based on the root directory and the temporary file store directory as I am not confident with how I am supposed to code the function. 

In order to upload the file the system needs to be able to store it in a folder. At this point I just created a folder within my major project folder called profileupload which will be used to store the user images. 



Although the folder's location might be moved to another I have identified several security issues:


  1. Placing images all in one folder face the issue of students stealing other peoples images therefore ideally the user image should be stored within their main folder
  2. Placing the folder within the project folder faces the issues of people altering the code and stealing information therefore the folder will either have to be moved or a security method must be in place
Now that I have a folder and the HTML set up I will need to add the rest of the PHP that processes the function to upload and embed the image.  

Sources
Htmlgoodies.com. 2013. Web Developer How To: Upload Images Using PHP. [online] Available at: http://www.htmlgoodies.com/beyond/php/article.php/3877766/Web-Developer-How-To-Upload-Images-Using-PHP.htm [Accessed: 26 Feb 2014].

PHP Freaks. n.d. how to uplad a file to the server - PHP Coding Help. [online] Available at: http://forums.phpfreaks.com/topic/154228-how-to-uplad-a-file-to-the-server/ [Accessed: 26 Feb 2014].

Tizag.com. n.d. PHP Tutorial - File Upload. [online] Available at: http://www.tizag.com/phpT/fileupload.php [Accessed: 26 Feb 2014].

No comments:

Post a Comment