I am working on something with file upload this might be a stupid question and people might down vote it but i want to understand what I am doing. I am still new to this. Ok when it says $filename=filenameSafe($_FILES['uploadXXXX']['name']); is the where i would out the name of the file that has the http or would it be the folder that the upload goes or the index that has the functions being called. Same as this line
$fileType=$_FILES["uploadXXXX"]["type"];
if (in_array($_FILES["uploadXXXX"]["type"],$aryImages)){
createThumb($fileType,$_FILES['uploadFile']['tmp_name'],$filename,10
I am getting a little bit confused. Same with I have a database name tblFile but I am not to sure where to put that at either. This is the other line of code
elseif (in_array($_FILES["uploadFile"]["type"],$aryDocs)){
move_uploaded_file($_FILES['uploadFile']['tmp_name'],
"/home/valerie2/public_html/elinkswap/YOURFULLPATH/".$filename);
$aryColumns=array("sessionID"=>$curSess,"fileName"=>$filename,"fileType"=>$fileType,"thumbFileName"=>$thumbFilename,"dateCreated"=>date('Y-m-d H:i:s'));
dbInsert($filename,$aryColumns,$_FILES["uploadXXXX"]["type"]);
}
Can someone might be able to help me understand this so I will not be so confused with it.Thank for everyone who reads this.
This line gets the filetype of the file (PDF, Doc, JPEG, PNG, etc.):
This line checks whether the filetype is in the list of allowed image formats, which is an array named
$aryImages:If the file is not an image, then this next line checks whether it is a document. If it is, then the uploaded document is moved to
/home/valerie2/public_html/elinkswap/YOURFULLPATH/and something happens with the database:I’m not sure why that database part is only applicable for the document format, though, and not for the images. I would think that it should be outside of the
ifloop.If you don’t understand how the code works, I don’t think you should use it. I suggest you try and write the code yourself, as you won’t have this problem.