Jump to content



Welcome to AstaHost - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!

Toggle shoutbox Shoutbox Open the Shoutbox in a popup

@  yordan : (16 June 2013 - 05:41 PM) You're Welcome, Agyat!
@  agyat : (16 June 2013 - 07:38 AM) Thanks Yordan...
@  velma : (16 June 2013 - 12:06 AM) I Have Asked Opa To Check For A Backup.. He'll Let Me Know Soon :)
@  velma : (16 June 2013 - 12:05 AM) T_T It Seems That Someone Has Deleted That Topic Since I Found The Url Of The Topic But It Gives Me An Error
@  yordan : (15 June 2013 - 10:31 PM) @velma : It's A Tuto On How To Create A Login Program.
@  yordan : (15 June 2013 - 10:31 PM) Happy Birthday To Youuuuuu Agyat!
@  yordan : (15 June 2013 - 10:31 PM) Ba$
@  agyat : (15 June 2013 - 04:41 PM) :(
@  agyat : (15 June 2013 - 04:41 PM) Where The Hall I Were? 15Th Is Almost At End And No-One Wished Me "happy Birthday"!!!
@  velma : (14 June 2013 - 10:39 AM) Which Tutorial Is He Searching For?
@  velma : (14 June 2013 - 10:38 AM) Which Tutorial Is He Searching For?
@  yordan : (14 June 2013 - 07:47 AM) Ok, Have A Look Tomorrow.
@  yordan : (13 June 2013 - 03:19 PM) @velma, Can You Have A Look At Feelay's Problem? Seems That His Tutorial Is Not Searchable Today.
@  Feelay : (13 June 2013 - 08:11 AM) Oh, Haha
@  velma : (12 June 2013 - 05:39 PM) T_T Lately My Levels Of Procrastination..... **sigh**
@  velma : (12 June 2013 - 05:38 PM) I'll Do It Later
@  velma : (12 June 2013 - 05:38 PM) Procrastinators.. People Who Keep Saying "i'll Do This In A Bit"
@  Feelay : (12 June 2013 - 02:05 PM) Deal Punishments To What?
@  velma : (12 June 2013 - 01:27 PM) T_T We Should Deal Punishments To Procrastinators... Especially Me
@  Feelay : (12 June 2013 - 12:06 PM) As Well As Making It More Secure.

Replying to PHP Script To Upload A File


Post Options

    • Can't make it out? Click here to generate a new image

  or Cancel


Topic Summary

TavoxPeru

Posted 17 April 2009 - 09:27 AM

Is video uploading site is good in PHP or ASP.Net
PHP Script To Upload A File

I am thinking to make video uploading site so now I am confused as should I make it in PHP or ASP.Net. So please give your suggestions as which technology would be good.

-reply by Simran


I think that PHP and ASP.net will work fine to do this job, only one thing, as far as i know, ASP.net only works with windows machines, it does not work on any other operating system like linux or freebsd, so take in mind this when you choose your hosting.

Best regards,

Posted 17 April 2009 - 02:51 AM

Is video uploading site is good in PHP or ASP.NetPHP Script To Upload A File

I am thinking to make video uploading site so now I am confused as should I make it in PHP or ASP.Net. So please give your suggestions as which technology would be good.

-reply by Simran

 


KazDoran

Posted 31 March 2006 - 12:02 PM

Yay I got it to work!

Here's how it goes, a very simple script, without password verification:

1) CHMOD your /tmp directory to 775 (very important!)

2) Create a form like this:

<form enctype="multipart/form-data" action="process.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="50000" />
File: <input type="file" name="uploadedfile"><br>
<input type="submit" value="Submit">
</form>

You MUST have enctype="multipart/form-data" or the file upload won't work!
MAX_FILE_SIZE limits the maximum file size, in bytes (in this case, around 50 KB).

3) Now the script inside process.php:
<?
$upload_dir="upload/"

$upload_path = $upload_dir . basename($_FILES['uploadedfile']['name']);

if(!move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $upload_path)){
	echo "Upload failed.";
	}
?>

Set the $upload_dir variable to whatever directory you wish to upload the file to.
The $upload_path variable will be the relative path to the file when it's in place.
If by any chance the file fails to upload, you'll be notified.

Hope this will help. To create a password protection just create a new form where you type the password and do a basic check to see if it matches. :lol:

KazDoran

Posted 31 March 2006 - 09:48 AM

Hi!

I was actually working on a PHP script to do just that. And unfortunately, it seems it won't work, for some reason. I've been asking around to find out what's wrong (I see the file isn't even uploaded as temporary file) and it may be that the PHP server in Astahost is running as root, and as such we needed root access to do the file upload... Not entirely sure though.

EDIT: Actually, it looks like the PHP upload_tmp_dir variable is empty, and that's why I can't put the files there as well...

Vyoma

Posted 21 March 2006 - 01:12 PM

nightfox, I cannot use the FTP option and the cpanel (that port is blocked). I have to go out to a net cafe to do it. Hence, I came up with this option that may work out.

nightfox

Posted 19 March 2006 - 05:52 AM

vujsa, I am sorry, I forgot to mention that I had tried the FTP option earlier. The network administrator here is a real security-paranoid.

Heh... they all seem to be that way, lol.

Perhaps if you're interested, you can upload files directly through cpanel to your web space. Here's a HOWTO:

1) Login to cPanel (http://yourURL/cpanel) with your username and password.
2) Under "Site Management Tools" in the first row, last column, you should see an icon labled as "File Manager". Click it.
3) A new window will open. You should see your home directory (outside public_html folder). Click the folder icon (NOT the folder name!) next to "public_html"
4) Click on the link in the top "Upload files" and you can upload 12 files at once!
5) Click on the link in the top "New folder" to add a new folder.
6) Click on a folder or file NAME (not the icon) to change its properties (CHMOD, re-name, etc), delete, edit, etc.

Good Luck! This will be much easier and is built into cpanel. You won't need to worry about getting a PHP script in and then keeping that script secure. :o

Best of luck with building your site the hard way (uploading through cpanel) but I suppose with security freaks on the other end of the proxy, you'll have to do it this way.

[N]F

Vyoma

Posted 19 March 2006 - 05:11 AM

Well, I think you guys all gave me a lot to think about. I might still try to use some kind of PHP code to upload my files, because when I checked, the proxy only lets me HTTP access. The admin is like, you know, wont budge an inch.

I will surely reply here on my findings after the research so others would be able to use it. (But, I should say, I am quite occupied with something else - my mind can be so mercurical, :o).

abhiram

Posted 12 March 2006 - 06:19 AM

I've got a similar problem. My campus net proxy blocks all ports except 3128. For file maintanance, I use Net2Ftp. Of course, it allows only uploads of 2mb and tasks which don't take more than 30sec. To get around this, just download the package from their site and extract it to your site. Then edit .htaccess accordingly (I'm not really sure how) to enable uploads of more than 2mb and edit the preferences also.

This works fine for me from everywhere. Hope it helps you. It's easier than writing the script from scratch :o.

vujsa

Posted 11 March 2006 - 03:50 PM

There aren't too many options to help this situation. If all non HTTP and Mail ports are blocked at the LAN firewall, there isn't any thing that can be done. I don't know for sure how the PHP ftp functions work when it comes to ports.

It may be that we can set up a php based ftp system for you that would work if it was hosted on your AstaHost account. It is still a lot of work to write but if you look around at http://php.resourceindex.com/ , yo may be able to find what you need pre written.

Since the comands sent to the serve are from the server, your LAN may never be involved with the transaction other than to submit the form and reply to the data.

I think this is how the flow of data works for a php based FTP transaction:
Your computer -> Your LAN -> AstaHost web server -> AstaHost FTP server -> AstaHost web server -> Your LAN -> Your computer

Given your situation, I think that it would be worth he time to test a few web based ftp scripts.

vujsa

Quatrux

Posted 11 March 2006 - 10:43 AM

According to his post, he can't use ftp because the cafe blocks it, or allows only the read permission. I would personally recommend using a pre-made script to upload files. You can find them floating around.


I saw it, but he was using Explorer and using Filezilla might help him as it is a real ftp client and it won't be blocked, but it is only a guess, he even did not use a password. Furthermore, Filezilla has proxy and firewall settings, so you can use a proxy to connect to the server and outcome the ISP or whatever Internet provider blocks. :o

But first you would need to find an proxy which support ftp protocol and which is fast, I don't think he cares if it is anonymous it sends his header details, I only have one proxy which I need, but it only works in my country as I been testing. So try to use google. But the alternative to use the ftp web based client pre-written is also quite a good idea, if real ftp client does not work, you can go with it. :P

Review the complete topic (launches new window)