Trang Chủ | Diễn Đàn | Thành Viên (Đăng Ký) | Tìm Kiếm | Tutorial Room

RA MẮT THỬ NGHIỆM PHIÊN BẢN MỚI CỦA DIỄN ĐÀN

PHP - Hỏi cách download trong php
Hỏi đáp, trao đổi về lập trình PHP.
- Các câu hỏi về tìm hosting hỗ trợ PHP xin hãy gởi vào box Web Hosting.
- Các câu hỏi về tìm chương trình forum, guestbook, hướng dẫn sử dụng, cấu hình các script viết bằng PHP...xin hãy gởi vào box Web Application.
First page Previous page  (Page 1 )   1     2     3   Next page Last page
Hỏi cách download trong php
Member
Member since
19:17 30-06-2010
Posts: 22
Fantasy Points: 86
Rank
angry Posted at 02:22 19-07-2010 Move Move Topic   Pin/Unpin Pin Topic   Lock Lock Topic
Anh cho em hỏi em xem chương trình download qua đường dẫn này http://www.diendantinho...ple_download_manager.php sao khi user download về nhưng lại mở file ra xem ko dc hả anh,em chỉ cho download thử 1 file test.txt thui nhưng mở ra ko xem đc là sao hả anh,giúp em với
Reply Reply   Quote Quote   Edit Edit   Delete Delete   Report Report
This post has been viewed 1,308 time(s). 1 direct repli(es) and 18 indirect repli(es).
Title Poster
angry Hỏi cách download trong php
 
answer Re: Hỏi cách download trong php
NBThanh
Re: Hỏi cách download trong php
Forum Moderator
Member since
20:03 17-08-2001
Posts: 18,133
Fantasy Points: 154,920
Rank
answer Posted at 03:35 19-07-2010
Reply to Hỏi cách download trong php (thangbuomphp)
Khi mở file ra có báo lỗi gì không? Chứ nói "không được" thì nso mông lung lắm.
Reply Reply   Quote Quote   Edit Edit   Delete Delete   Report Report
This post has been viewed 1,305 time(s). 1 direct repli(es) and 17 indirect repli(es).
Title Poster
answer Re: Hỏi cách download trong php
 
answer Re: Hỏi cách download trong php
thangbuomphp
Re: Hỏi cách download trong php
Member
Member since
19:17 30-06-2010
Posts: 22
Fantasy Points: 86
Rank
answer Posted at 20:08 19-07-2010
Reply to Re: Hỏi cách download trong php (NBThanh)
mở file ra đc nhưng ko có data trong đó, anh giúp dùm em cái or toàn là những thẻ HTML ko àh chứ ko thấy dữ liệu.
Reply Reply   Quote Quote   Edit Edit   Delete Delete   Report Report
This post has been viewed 1,275 time(s). 1 direct repli(es) and 16 indirect repli(es).
Title Poster
answer Re: Hỏi cách download trong php
 
answer Re: Hỏi cách download trong php
NBThanh
Re: Hỏi cách download trong php
Forum Moderator
Member since
20:03 17-08-2001
Posts: 18,133
Fantasy Points: 154,920
Rank
answer Posted at 20:11 19-07-2010
Reply to Re: Hỏi cách download trong php (thangbuomphp)
toàn là những thẻ HTML ko àh chứ ko thấy dữ liệu.

Nó sẽ chứa những thông tin báo lỗi. Bạn cần phải tìm hiểu xem nó báo lỗi gì trong trường hợp của bạn. Chứ bạn không cung cấp thông tin gì rõ ràng thì làm sao mà giúp bạn được.
Reply Reply   Quote Quote   Edit Edit   Delete Delete   Report Report
This post has been viewed 1,273 time(s). 1 direct repli(es) and 15 indirect repli(es).
Title Poster
answer Re: Hỏi cách download trong php
 
answer Re: Hỏi cách download trong php
thangbuomphp
Re: Hỏi cách download trong php
Member
Member since
19:17 30-06-2010
Posts: 22
Fantasy Points: 86
Rank
answer Posted at 21:14 19-07-2010
Reply to Re: Hỏi cách download trong php (NBThanh)
ví dụ:em cho download về 1 file ducument.zip nhưng nó user down về chỉ đc cái vỏ ko àh ko giải nén ra đc, khi giải nén nó báo thế này nè:! C:\Documents and Settings\trieu huy\Desktop\chuthich1.zip: The archive is either in unknown format or damaged
cũng như file test.txt mở ra ko có dữ liệu gì hết đó anh
Reply Reply   Quote Quote   Edit Edit   Delete Delete   Report Report
This post has been viewed 1,270 time(s). 1 direct repli(es) and 14 indirect repli(es).
Title Poster
answer Re: Hỏi cách download trong php
 
answer Re: Hỏi cách download trong php
NBThanh
Re: Hỏi cách download trong php
Forum Moderator
Member since
20:03 17-08-2001
Posts: 18,133
Fantasy Points: 154,920
Rank
answer Posted at 21:46 19-07-2010
Reply to Re: Hỏi cách download trong php (thangbuomphp)
thangbuomphp:
ví dụ:em cho download về 1 file ducument.zip nhưng nó user down về chỉ đc cái vỏ ko àh ko giải nén ra đc, khi giải nén nó báo thế này nè:! C:\Documents and Settings\trieu huy\Desktop\chuthich1.zip: The archive is either in unknown format or damaged
cũng như file test.txt mở ra ko có dữ liệu gì hết đó anh

Bạn coi kỹ lại dung lượng file có phải là 0 byte?
Nếu là 0 byte thì tức là trong quá trình chạy có lỗi nào đó (ví dụ như bạn gõ sai cú pháp, thiếu chấm phảy hoặc dư dấu ngoặc, hoặc chương trình đọc không được file trên server v.v...) nên nó trả về file 0 byte. Cái này thì bạn phải xem kỹ chương trình, và cần thiết thì bật chế độ báo lỗi trong file php.ini lên để xem cụ thể lỗi nó là gì.
Còn nếu file không phải là 0 byte thì bạn lấy notepad mở nó ra xem bên trong có thông báo lỗi gì không?
Reply Reply   Quote Quote   Edit Edit   Delete Delete   Report Report
This post has been viewed 1,267 time(s). 1 direct repli(es) and 13 indirect repli(es).
Title Poster
answer Re: Hỏi cách download trong php
 
answer Re: Hỏi cách download trong php
thangbuomphp
Re: Hỏi cách download trong php
Member
Member since
19:17 30-06-2010
Posts: 22
Fantasy Points: 86
Rank
answer Posted at 22:00 19-07-2010
Reply to Re: Hỏi cách download trong php (NBThanh)
Chắc em nghỉ là server đọc ko đc chứ cú pháp em coi lại rui ko có gì sai:em up đoạn code lên cho a coi dùm nha:
dow.php
<?php
$filename = "chuthich1.zip";
$fp = fopen($filename, "rb");

header("Content-type: application/octet-stream");
header('Content-disposition: attachment; filename="'.$filename.'"');
header("Content-length: ".filesize($filename));

fpassthru($fp);
fclose($fp);

?>
chỉ đơn giản thế thui mà ko đc nữa nản quá.file đó em để chung với forder dow.php luôn nhưng cũng ko đc
Reply Reply   Quote Quote   Edit Edit   Delete Delete   Report Report
This post has been viewed 1,265 time(s). 1 direct repli(es) and 12 indirect repli(es).
Title Poster
answer Re: Hỏi cách download trong php
 
answer Re: Hỏi cách download trong php
NBThanh
Re: Hỏi cách download trong php
Forum Moderator
Member since
20:03 17-08-2001
Posts: 18,133
Fantasy Points: 154,920
Rank
answer Posted at 22:25 19-07-2010
Reply to Re: Hỏi cách download trong php (thangbuomphp)
Bạn có thể thêm vào 1 lệnh if ở sau lệnh fopen để kiểm tra xem file có được mở thành công hay không. Bạn tham khảo thêm manual của fopen để biết chi tiết: http://php.net/manual/en/function.fopen.php
Reply Reply   Quote Quote   Edit Edit   Delete Delete   Report Report
This post has been viewed 1,262 time(s). 1 direct repli(es) and 11 indirect repli(es).
Title Poster
answer Re: Hỏi cách download trong php
 
answer Re: Hỏi cách download trong php
thangbuomphp
First page Previous page  (Page 1 )   1     2     3   Next page Last page

Permissions: Create Topic: No  |  Reply Topic: No  |  Attach File: No  |  Make Poll: No

Vietnamese Keyboard: AUTO TELEX VNI VIQR VIQR* OFF

Go top || Print page ||

All logos, trademarks and graphics artwork in this site are property of their respective owners.
Opinions expressed in articles within this site are those of their owners and may not reflect the opinion of TXBB.

TXBB: Home - Disclaimer - Help - Contact
Copyright (C) 2000-2006 TXBB. All rights reserved.

TreXanh Bulletin Board v2.0 (Build: #332 Nov 21, 2006)

DEBUG INFORMATION
Execution 0.202s - SQL used 3s - Concurrent process(es) 0