Jump to content

Works in Firefox but NOT in Window's IE


aiikcmo

Recommended Posts

I have been at it for awhile now, it could be easy to fix but I don't see it.  I'm having problems deleting and downloading files. I know that I can do this because it works great with Firefox.  The problem is that when in any internet explore I try and download files or delete them I get warnings that result in no file paths or a failed function.  I don't understand, I post my file path to the function. Here is the output and I tried to hardcode it once and it still failed. I'm going to assume the header errors are there because the previous function failed.

 

$file = $_POST['file'];

 

$size = filesize($file);

 

$saveName = basename($file);

....

 

Warning: filesize() [function.filesize]: stat failed for Download in /home/aiiam0/public_html/process.php on line 441

 

Warning: Cannot modify header information - headers already sent by (output started at /home/aiiam0/public_html/process.php:441) in /home/aiiam0/public_html/process.php on line 445

 

Warning: filemtime() [function.filemtime]: stat failed for Download in /home/aiiam0/public_html/process.php on line 449

 

Warning: Cannot modify header information - headers already sent by (output started at /home/aiiam0/public_html/process.php:441) in /home/aiiam0/public_html/process.php on line 449

 

$file = $_POST['file'];

 

unlink( $file );

 

header("Location: download.php");

 

Warning: unlink(Delete) [function.unlink]: No such file or directory in /home/aiiam0/public_html/process.php on line 530

 

Warning: Cannot modify header information - headers already sent by (output started at /home/aiiam0/public_html/process.php:530) in /home/aiiam0/public_html/process.php on line 532

Link to comment
Share on other sites

Here is a the code take a look at the del function, I have commented out the header part and the error went away, for that, its like it dosen't see the file and after that if just dies on the header statements. My page sends to the process script and has NO whitespaces or html in it and then processes it.

 

Warning: unlink(Delete) [function.unlink]: No such file or directory in /home/aiiam0/public_html/process.php on line 209

 

function procDeleteFile

 

$file = $_POST['file'];

unlink($file);//header("Location: download.php");//header("Location: ".$session->referrer);*This is LINE 209*

 

 

Link to comment
Share on other sites

If it's on a different level than the script, provide the path to it.

 

What do you mean, please explain a little.

 

Yes,  Daniel0 I agree with you, but what doesn't sit well with me is that it works in one browser and not the other browser. Is IE doing something diffrent with the path or post? I guess I will just move the code into the sending page to see if that makes a difference and I will have to write some test code to check to make sure the path from IE is good.  Thanks for the help  ;)

Link to comment
Share on other sites

If its not in the same folder as the script your running you have to add what folder its in.

 

Say one file is in :

 

main root - test .php  (this file wants to file test3.php)

 

main root - subfolder - test3.php  (you put

include("/subfolder/test3.php")

)

 

But if you want to do the opposite so say test3 needs to find test you can do:

include("../test.php");

As the .. will tell it to look in the main root folder.

 

 

Of in your case its not include but "location"

Link to comment
Share on other sites

Echo $file to see what it actually contains.

 

When a form submits different/wrong values from different browsers, it is usually because the html markup is invalid and one browser ignores the html errors and the other one does not. To get help with your form, you would need to post your code.

 

Edit: The error message would seem to indicate that $file contains the word "delete" from IE.

Link to comment
Share on other sites

ok, here is my form/post code. Yes it seems that delete, the button name is being passed instead of the value, but this is my first website so yea, maybe I didn't use it correctly and Firefox was nice enough to post it.  Its a mess to read because it is used in a loop for each file found in the folder. My idea was that I post it to a process file which is directed to the correct function by the hidden field and the value of post is used to produce the outcome.  I'll I wanted was to have a named button to send a path to a function.

 

<form action=\"process.php\" method=\"post\"><button name=\"file\" value=".($f."/".$item)." type=\"submit\">Delete</button><input type=\"hidden\" name=\"subdelete\" value=\"1\"></form>

 

echo "<tr><td><b>$item</b></td><td><b>".round((filesize($f."/".$item)/1024),1)."</b></td><td><b>".date("m-d-y, g:i:sa", fileatime($f."/".$item))."</b></td><td><form action=\"process.php\" method=\"post\"><button name=\"file\" value=".($f."/".$item)." type=\"submit\">Download</button><input type=\"hidden\" name=\"subdownload\" value=\"1\"></form></td><td><form action=\"process.php\" method=\"post\"><button name=\"file\" value=".($f."/".$item)." type=\"submit\">Delete</button><input type=\"hidden\" name=\"subdelete\" value=\"1\"></form></td></tr>\n";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.