Hi Jacek,
Yes, I would prefer if the file was deleted after it had expired.
Search found 26 matches
- Mon May 30, 2016 2:16 am
- Forum: PHP
- Topic: Temporary Download Script - Unlink file after download
- Replies: 3
- Views: 16367
- Thu May 05, 2016 3:34 pm
- Forum: PHP
- Topic: Temporary Download Script - Unlink file after download
- Replies: 3
- Views: 16367
Temporary Download Script - Unlink file after download
Hi Folks, Quick question: How would I go about using the unlink(); function to delete files from the 'files' folder after a user has downloaded the file? Download.php File <?php include('core/inc/init.inc.php'); if (isset($_GET['file_id'])) { $file_id = (int) $_GET['file_id']; $file = mysql_query(&q...
- Mon Feb 03, 2014 8:25 pm
- Forum: Tutorials
- Topic: Problems with the Unique download link tutorial
- Replies: 3
- Views: 2860
Re: Problems with the Unique download link tutorial
Hi, I thought I had the script working correctly. However I've come across a problem, If I don't browse for a file too upload and hit upload twice the "Download file" hyperlink appears and allows me to download "download.php". Original Tutorial Link --> http://betterphp.co.uk/boa...
- Thu Jan 30, 2014 2:26 pm
- Forum: Tutorials
- Topic: Problems with the Unique download link tutorial
- Replies: 3
- Views: 2860
Problems with the Unique download link tutorial
Hi,
After taking a break for 5 minutes I came back and realized where I went wrong. Correct code below;
After taking a break for 5 minutes I came back and realized where I went wrong. Correct code below;
echo'<a href="download.php?code='.$unique_code.'">Click</a>';Thanks anyway for your help, ScTech
- Sun Jan 19, 2014 11:57 pm
- Forum: General Chat
- Topic: Tutorials?
- Replies: 15
- Views: 12532
Re: Tutorials?
Sounds like a great idea folks. Sorry I haven't been around much had a few family issues I had to sort out.
- Thu Aug 29, 2013 11:30 pm
- Forum: PHP
- Topic: Temporary link Download
- Replies: 30
- Views: 16043
Re: Temporary link Download
Temor wrote:We're a rare breeddavestechuk wrote:lol, Temor I'm glad its finally working as well. Thanks again guys for your help it really is appreciated shame there isn't more folks like yourselves on the internet willing to help with coding issues.Temor wrote:Hooray!
lol, Thanks again I appreciate it.
- Thu Aug 29, 2013 2:49 pm
- Forum: PHP
- Topic: Temporary link Download
- Replies: 30
- Views: 16043
Re: Temporary link Download
lol, Temor I'm glad its finally working as well. Thanks again guys for your help it really is appreciated shame there isn't more folks like yourselves on the internet willing to help with coding issues.Temor wrote:Hooray!
- Thu Aug 29, 2013 2:40 am
- Forum: PHP
- Topic: Temporary link Download
- Replies: 30
- Views: 16043
Re: Temporary link Download
Found the issue in upload.php :) You can go ahead and remove those lines I told you to put in if it works. if (in_array($file_ext, $allowed_ext) ===false){ $errors[] = 'File extension not allowed'; Right here you are not ending the bracket until later on so you are only defining $expiry if they upl...
- Thu Aug 29, 2013 2:13 am
- Forum: PHP
- Topic: Temporary link Download
- Replies: 30
- Views: 16043
Re: Temporary link Download
We are here to help :) Try putting this under your opening PHP tag at the top of upload.php error_reporting(E_ALL); ini_set('display_errors', 1); The only error I'm getting with error reporting turned on is Notice: Undefined variable: expiry in /home/davestec/public_html/tutorial/upload.php on line...
- Wed Aug 28, 2013 11:43 pm
- Forum: PHP
- Topic: Temporary link Download
- Replies: 30
- Views: 16043
Re: Temporary link Download
What happens if you remove the quotes around $expiry in your upload query? mysql_query("INSERT INTO files (file_name, file_expiry) VALUES ('{$file_name}','{$expiry}')"); mysql_query("INSERT INTO files (file_name, file_expiry) VALUES ('{$file_name}',{$expiry})"); It is, after all...
- Wed Aug 28, 2013 8:59 pm
- Forum: PHP
- Topic: Temporary link Download
- Replies: 30
- Views: 16043
Re: Temporary link Download
Could you post all the code you have now, so I can get an overview? File Name: init.inc.php <?php mysql_connect('localhost','username','password'); mysql_select_db('database'); ?> File Name: upload.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/...
- Wed Aug 28, 2013 7:42 pm
- Forum: PHP
- Topic: Temporary link Download
- Replies: 30
- Views: 16043
Re: Temporary link Download
Please post file_list.php in case there's a difference. Also, what are the expiry values in the database both when you don't insert a number, and when you do. <?php include('assets/inc/init.inc.php'); $files = mysql_query("SELECT file_id, file_name, file_expiry FROM files"); ?> <html> <he...
- Wed Aug 28, 2013 2:58 pm
- Forum: PHP
- Topic: Temporary link Download
- Replies: 30
- Views: 16043
Re: Temporary link Download
Files is now showing in the file_list.php. but, I can't download the file as its set the date and time to the following 01/01/1970 00:00:00ScTech wrote:You're missing apostrophes around $expiry in your query on upload.php
- Tue Aug 27, 2013 11:52 pm
- Forum: PHP
- Topic: Temporary link Download
- Replies: 30
- Views: 16043
Re: Temporary link Download
One small problem. Where it is validating with ctype_digit, you are using echo which won't stop it from continuing. You should set that as $errors instead of echoing it. Have you edited file_list.php since? What does the database show when you leave it blank and when you insert a number? No, I have...
- Tue Aug 27, 2013 2:50 pm
- Forum: PHP
- Topic: Temporary link Download
- Replies: 30
- Views: 16043
Re: Temporary link Download
You shouldn't just paste the code in there. You have doubles now! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Upload a File</title> <style type="text/css"> table { border...
- Tue Aug 27, 2013 3:14 am
- Forum: PHP
- Topic: Temporary link Download
- Replies: 30
- Views: 16043
Re: Temporary link Download
Don't take me the wrong way here. All you have to do is just follow the steps of the code and find the one where your modification fits. It's like a puzzle. You have to look at the part you're gonna put in and take note that it is giving $expiry a value, and then match it to where you do that in yo...
- Mon Aug 26, 2013 10:31 pm
- Forum: PHP
- Topic: Temporary link Download
- Replies: 30
- Views: 16043
Re: Temporary link Download
Beat me to it Temor :) I should also mention that you should look into checking file extensions and only allow a few. Any files that can execute code like .php,.html.py.js etc. you should filter out because they can potentially break into your file system, or worse. To make it more simple because t...
- Mon Aug 26, 2013 2:27 pm
- Forum: PHP
- Topic: Temporary link Download
- Replies: 30
- Views: 16043
Re: Temporary link Download
You would just check if they left it blank. However, you need more validation for what you're doing because you aren't checking that what they're entering is actually a number. To accomplish what you're trying to do, first make sure that if they enter something that it's a number so it won't cause ...
- Mon Aug 26, 2013 12:21 pm
- Forum: PHP
- Topic: Temporary link Download
- Replies: 30
- Views: 16043
Temporary link Download
Hi Folks, I am wondering how I would set a default period for a file to expire? At the moment you enter the number of minutes you want the file to be active, and after that set time the file expires. But, I want to add some functionality so that, by default, the file will expire after 10 minutes, sa...
- Fri Aug 23, 2013 3:41 am
- Forum: Code
- Topic: Contact Form
- Replies: 4
- Views: 3116
Re: Contact Form
You should filter the email contents. I ran into a problem where an email provider I used had failed to filter JavaScript. Hidden fields are also editable. You should collect the ip by php once they submit the form. As for $_SERVER['REMOTE_ADDR'] being echoed unfiltered, Server variables are suppli...
- Mon Aug 19, 2013 7:07 pm
- Forum: Code
- Topic: Contact Form
- Replies: 4
- Views: 3116
Re: Contact Form
Hey Temor,
Thanks, I appreciate the kind comments... feel free to copy and paste the code and change the styling if you wish, I have no problem with that it all. After all I posted it up there for people to use and modify it how they like!
Thanks, I appreciate the kind comments... feel free to copy and paste the code and change the styling if you wish, I have no problem with that it all. After all I posted it up there for people to use and modify it how they like!