Ave,

I made a change last evening, and since the change.. It seems to be working
fine. Thus far I haven't had the 1 KB downloaded file problem. I have been
trying all evening and this morning, from different places, and somehow
right now it seems to be working fine.

What I simply did was this:

Instead of 

<a 
href=\"imsafm_user_dl.php?ID=$myrow[ID]&P=imsafm/$user&F=$myrow[filename]\">
<img src=b_newtbl.png border=0></a>

As my link to the download file, I changed it to

<a href=\"imsafm_user_dl.php?F=imsafm/$user/$myrow[filename]\"><img
src=b_newtbl.png border=0></a>

And changed the code in the download file to

<?php
header("Content-Description: File Transfer");
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=".basename($F));
@readfile($F);
?> 

I didnšt need to send the ID var to the download file, and I condensed the
number of Variables I was passing.

Somehow this seems to be working for me. I was just trying this out to one
by one eliminate possibilities. And it works.Since I made this change, the
actual file is being downloaded and not the 1 KB file.
I donšt really know why though. I understand I didnšt need to divide the
path into 2 variables. But what if I really needed to send the ID variable?
I donšt exactly understand how this setup of Variables affected the file
being downloaded.

Thanks anyways.







On 9/15/04 5:35 PM, "Marek Kilimajer" <[EMAIL PROTECTED]> wrote:

> PHP Junkie wrote:
>> Ave,
>> 
>> I've been having a very nagging and frustrating problem for a while and I
>> hope someone can help me out with this.
>> 
>> I created a simple File Manager application, a lot of you already know about
>> it as you helped me with coding at different stages.
>> 
>> The problem is this: The Download.
>> When you download a file, it's giving problems sometimes. What is happening
>> is, a 1 KB file downloads instead of the actual file. And thus the file
>> downloaded is no good. The file uploaded is absolutely perfect. Since I have
>> the web server which contains this website, I'm easily able to check all
>> these things. When a user uploads a file, it's uploaded absolutely perfect.
>> It's not a 1 KB file.. The whole file is uploaded and it's not corrupt. But
>> when a user downloads the file... Most of the time a 1 KB file is
>> downloaded.. And its' corrupt of course.
>> 
>> The more frustrating part is, it happens sometimes.. Not everytime. It is
>> happening 90% of the time.. But sometimes it is able to download the actual
>> file. If you try the same file from different locations, 15 times... 1 out
>> of 15 times the file will download fine.
>> 
>> I've been doing all sorts of testing to narrow down the problem but I don't
>> know the problem.
>> 
>> This is my download script :
>> 
>> <?php
>> $file = "$P/$F";
>> header("Content-Description: File Transfer");
>> header("Content-Type: application/force-download");
>> header("Content-Disposition: attachment; filename=".basename($file));
>> @readfile($file);
>> ?> 
>> 
>> Which is called using this link on the main page:
>> 
>> <a 
>> href=\"imsafm_user_dl.php?ID=$myrow[ID]&P=imsafm/$user&F=$myrow[filename]\">
>> <img src=b_newtbl.png border=0></a>
>> 
> 
> What does the 1 KB file contain? Is it the beginning of the wanted file?
> Remove @ while debuging.
> Add header('Content-Lenght: ' . filesize($file));
> Check server logs.
> 
> HTH
> 
> 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to