🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.php
Article #230967

Problem z usunięciem pliku po operacji download

#230967
From: mwitkowski2b
Date: Mon, 18 May 2015 11:30
31 lines
2028 bytes
Witam

Mam taka sytuację:
Umożliwiam użytkownikowi ściąganie pliku. Plik który jest w formacie CSV, jest tworzony na dysku serwera, po czym na koniec tej operacji chcę usunąć ściągnięty przez użytkownika plik. Fragment funkcji, która realizuje to zadanie jest następujący:

ignore_user_abort(true);
set_time_limit(0); 
header('Content-Description: File Transfer');
header('Content-type: text/csv');
header('Content-Disposition: attachment; filename='.basename($file));
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));

// sciagnij plik		
if(readfile($file))
{
   // (1)
   if($usuwac_plik == '1')
   {
      // usuń plik
      unlink($file);		
   }
}

Problem polega na tym, że plik nie jest usuwany. Aplikacja pracuje pod IIS 6.


Pozdrawiam
MW
Technical Details
Message-ID: <5883811d-6a41-4aa4-92fd-68c5447b469b@googlegroups.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!news.cyf-kr.edu.pl!news.nask.pl!news.nask.org.pl!news.unit0.net!news.glorb.com!h15no5106354igd.0!news-out.google.com!k20ni30381qgd.0!nntp.google.com!z60no1791294qgd.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Received: by 10.42.106.197 with SMTP id a5mr46163255icp.30.1431948618115;        Mon, 18 May 2015 04:30:18 -0700 (PDT)
X-Received: by 10.140.38.232 with SMTP id t95mr309018qgt.36.1431948618086; Mon, 18 May 2015 04:30:18 -0700 (PDT)
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!news.cyf-kr.edu.pl!news.nask.pl!news.nask.org.pl!news.unit0.net!news.glorb.com!h15no5106354igd.0!news-out.google.com!k20ni30381qgd.0!nntp.google.com!z60no1791294qgd.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: pl.comp.lang.php
Date: Mon, 18 May 2015 04:30:17 -0700 (PDT)
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=82.177.194.35; posting-account=E-z6ZwoAAACYsJZxZNjBCrM3zzyF6Vo_
NNTP-Posting-Host: 82.177.194.35
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5883811d-6a41-4aa4-92fd-68c5447b469b@googlegroups.com>
Subject: Problem z usunięciem pliku po operacji download
From: mwitkowski2b@gmail.com
Injection-Date: Mon, 18 May 2015 11:30:18 +0000
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit