Jump to content

Question on uploading and downloading compressed (zip) files


tryingtolearn

Recommended Posts

Is there any special procedures for doing this?

 

I found a script on a forum (But it is dated 2003) not sure if that matters

 

But here is the problem

Everything uploads fine and then I go to download and that works as well

The problem is that when I try to uncompress (Or is it decompress) the downloaded file

It wont, The compressed file extraction wizard says its empty

But it isnt - If I email the compressed file to myself it works fine

 

So Im wondering if there is something in the script that is causing the problem

 

<?php 
error_reporting(E_ALL); 

$file_path = '/home/public_html/files/'; 

if (empty($_REQUEST['file']) || !preg_match("/^[a-zA-Z_0-9]+.+[a-zA-Z0-9]+$/", $_REQUEST['file'])) { 
    die('Not a valid URL.'); 
} 

header("Content-type: application/octet-stream\n"); 
header("Content-disposition: attachment; filename=\"" . $_REQUEST['file'] . "\"\n"); 
header("Content-transfer-encoding: binary\n"); 
header("Content-length: " . filesize($file_path . $_REQUEST['file']) . "\n"); 

$fp = fopen($file_path . $_REQUEST['file'], "r"); 

fpassthru($fp); 
die(); 
?> 

Mad Techie,

Thanks for the response

 

I found the problem, I was trying to do some database updating during the process

I rearranged how that was working and it is working fine now.

 

I appreciate you taking hte time

Thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.