Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6882385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:14:48+00:00 2026-05-27T05:14:48+00:00

I am working on something with file upload this might be a stupid question

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:14:48+00:00Added an answer on May 27, 2026 at 5:14 am

    This line gets the filetype of the file (PDF, Doc, JPEG, PNG, etc.):

    $fileType=$_FILES["uploadXXXX"]["type"];
    

    This line checks whether the filetype is in the list of allowed image formats, which is an array named $aryImages:

    if (in_array($_FILES["uploadXXXX"]["type"],$aryImages)){
        createThumb($fileType,$_FILES['uploadFile']['tmp_name'],$filename,10);
    

    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:

    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"]);
        }
    

    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 if loop.


    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm still working on a particular RDF file, but seems that something is not
I'm working on something that requires traversing through the file system and for any
I´m trying to upload a file which is fetched from a server. But when
I have a working Ajax form, now I'm trying to add file upload to
I am working on a file upload system which will store individual parts of
I'm working on something that was built on a PC set-up using php and
I'm working on something that pulls in urls from delicious and then uses those
I'm working on something of a wizard-type application to allow users to build simple
So I'm working on something in obj-c (I'd rather not say what) where I
I am willing to develop a mobile application. I wish to have something working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.