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

  • Home
  • SEARCH
  • 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 7029863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:35:38+00:00 2026-05-28T00:35:38+00:00

How do I pass a file path from a file input to my php

  • 0

How do I pass a file path from a file input to my php via jquery/ajax? I have an html page with a file input button then ajax passes “form” elements to a php script, but the path is just a filename. As I understand it, it is a security risk, but I can get the path using php…

$img = imagecreatefromjpeg($_FILES['image']['tmp_name']);

I was using a plain old form and decided to switch to an cooler ajaxy form-like setup.

        /* Submit the request. */
        $.ajax
        ({
            type:     "post",
            dataType: "json",
            url:      "ajax/make_preview.php",
            data: 
            {
                filePath:   filePath,
                chartName:  chartName,
                Width:      Width,
                Height:     Height,
                Colors:     Colors,
                flossBrand: flossBrand
            },
            success: function(ResponseData)
...

Is there any way to do this without hacking around the security measures? Or do I need to go back to a crappy form to accomplish it? I do not need to see or manipulate the path…just trying to get the file into a gd image object.

Thank you so much,
Todd

EDIT: I should note that I do not want jQuery to do the upload. I am just trying to let php know the correct file to upload.

  • 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-28T00:35:39+00:00Added an answer on May 28, 2026 at 12:35 am

    Passing the local file path to the server doesn’t help you to upload the file. The file content should be passed via request, the normal ajax cant do that by itself.

    You should try file upload plugins like http://www.uploadify.com/ etc.

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

Sidebar

Related Questions

If you try to pass the username/password to OpenVPN from a file via the
I have a html file which select images from user's computer.code is given bellow
I want to pass a file path as a parameter to an executable from
I want to call an ASHX file and pass some query string variables from
How can one pass command line arguments via file association in Vista 64? I
Is there a unix tool to which I can pass a file and have
I am trying to make this function download file from the internet. I pass
The below method takes a path pointing to an XML file: tree.LoadContentFile(path); I pass
I need to pass a file path name to a module. How do I
I want to pass two file path (for windows) to the script as command

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.