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.