This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's Calculator Programming subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. General Coding and Design => Calculator Programming
Author Message
elfprince13
Retired


Super Elite (Last Title)


Joined: 11 Apr 2005
Posts: 3500

Posted: 13 Jul 2005 03:34:46 pm    Post subject:

I need a php uploading system for my website that allows members to upload animations of different kinds (.mov, .gif, .swf) and have them automatically displayed on a separate page. I think this is possible but I dont know very much PHP. could somebody give me some help on this? I can take care of making sure only members access the page, but after that..... all I can think of is some judicious use of $echo and a database to keep track of uploaded files.....

Last edited by Guest on 13 Jul 2005 03:35:14 pm; edited 1 time in total
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 13 Jul 2005 04:52:15 pm    Post subject:

Let them select a file through a form..

<form enctype="multipart/form-data" action="uploadscript.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
upload file: <input name="userfile" type="filename" /> <br>
<input type="submit" value="Upload" />
</form>

Then, in the php script all you have to do to actually move it to where you want (it's uploaded to a temp folder first):

move_uploaded_file( $_FILES["uploadfile"]["tmp_name"], "uploaddirpath/" . $_FILES["userfile"]["name"] )

Replace "uploaddirpath/" with the path of wherever you want the file to be uploaded to.

Of course it's nice to add error handling and form validation and such.

More info:
http://nl2.php.net/manual/en/function.move-uploaded-file.php
http://maconlinux.net/php-online-manual/en...ile-upload.html
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 13 Jul 2005 04:58:34 pm    Post subject:

Displaying the files:

$dir = "the/dir/you/uploaded/everything/to";
if ( is_dir( $dir ) ) { //check if it's a dir
if ( $hDir = opendir( $dir ) ) { //open a directory handle
while ( $file = readdir( $hDir ) ) { //read the next file from the dir
//add any checking for filetypes and such here if you want
echo "filename: $file : filetype: " . filetype( $hDir . $file ) . "\n"; //display stuff about the file
}
closedir( $hDir ); //close directoryhandle
}
}

Instead of echoing each file I'd add it to a content string for a template parser like the rest of the page, then echo that string variable.

Replace the echo with something like this to make it display as an image on the page:
echo "<img src=\"$dir\\$file\">";

More info:
http://www.php.net/manual/en/ref.dir.php


Last edited by Guest on 13 Jul 2005 05:01:23 pm; edited 1 time in total
Back to top
lloydkirk1989


Member


Joined: 18 Apr 2005
Posts: 161

Posted: 13 Jul 2005 05:45:42 pm    Post subject:

Why not use the Invision Power File Uploader? Its free and nothing beats IP.

Last edited by Guest on 13 Jul 2005 05:46:07 pm; edited 1 time in total
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement