Goodnight everyone, I need to upload an image to a folder named “church” retrieving data via $ _REQUEST, you see, my page sends data to a file named “data.php” this way:
$. ajax ({
url: 'data.php'
date: {
"name": image_desc,
"image": image_url,
"url": url_link
}
The page has data.php this code:
<php
$name = $ _REQUEST ['name'];
$image = $ _REQUEST ['image'];
$url = addslashes ($ _REQUEST ['url']);
$uploadd = 'church /';
// till here code works fine
if I use -> echo $ image
//Its prints: C: \\ fakepath \\ frieds.jpg which is not the problem.
The problem is the time to upload the image folder to church:
// Do not know what I use on the lines below to the image is moved to folder
$fileName = $_FILES [$image] ['name'];
$tmpnam = $_FILES [$image] ['tmp_name'];
$fileSize = $_FILES [$image] ['size'];
$fileType = $_FILES [$image] ['type'];
$filePath = $uploadd. $fileName;
$result = move_uploaded_file ($tmpnam, $filePath);
if ($result) {
echo "Error uploading file";
exit;
}
The above code always return me several errors eg:
Notice: Undefined index: C: \\ fakepath \\ frieds.jpg in [My-Local-Folder]\\data.php on line 7
Notice: Undefined index: C: \\ fakepath \\ frieds.jpg in [My-Local-Folder]\\data.php on line 8
Notice: Undefined index: C: \\ fakepath \\ frieds.jpg in [My-Local-Folder]\\data.php on line 9
Notice: Undefined index: C: \\ fakepath \\ frieds.jpg in [My-Local-Folder]\\data.php on line 10
Error uploading file
I appreciate the responses