|
|
|
|
![]() ![]() |
Oct 23 2004, 07:23 PM
Post
#1
|
|
|
Member [Level 2] ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 75 Joined: 23-October 04 Member No.: 1,913 |
is there an easy way to do this? i've been searching around and everything i've found looks very complicated. can someone point me to a resource that explains how to do this? just want something simple browse open and upload, with limit on the file size and just certain kind of files like pdfs and jpgs no exe or anything that could have viruses.
|
|
|
|
Oct 23 2004, 07:34 PM
Post
#2
|
|
|
Ancient Enigma ![]() Group: [MODERATOR] Posts: 1,788 Joined: 11-July 04 From: under the stars Member No.: 76 |
huh?
but you can't use ASP on trap17 servers. you get hosted soon. try PHP instead. on general issues about uploading, you can use your cpanel later, or an FTP app. (just search the forums for these, this has been answered time and again here.) or do you mean other things than what i tried to answer here? as i've said, i'm lost in fully understanding what you are trying to express in your post. |
|
|
|
Oct 23 2004, 11:57 PM
Post
#3
|
|
|
Member [Level 2] ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 75 Joined: 23-October 04 Member No.: 1,913 |
Ohh I thought asp was enabled on trap17, ummm well then I'll try something else, can you do that with php? I mean have people upload filed to the website, so then I can review them and post them on the respetive places....well thanks
|
|
|
|
Oct 24 2004, 12:32 AM
Post
#4
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 148 Joined: 23-August 04 Member No.: 883 |
If you only want upload files , simple use :
bool is_uploaded_file ( string filename) and now is sample : <?php /* Userland test for uploaded file. */ function is_uploaded_file($filename) { if (!$tmp_file = get_cfg_var('upload_tmp_dir')) { $tmp_file = dirname(tempnam('', '')); } $tmp_file .= '/' . basename($filename); /* User might have trailing slash in php.ini... */ return (ereg_replace('/+', '/', $tmp_file) == $filename); } /* This is how to use it, since you also don't have * move_uploaded_file() in these older versions: */ if (is_uploaded_file($HTTP_POST_FILES['userfile'])) { copy($HTTP_POST_FILES['userfile'], "/place/to/put/uploaded/file"); } else { echo "Possible file upload attack: filename '$HTTP_POST_FILES[userfile]'."; } ?> If you want upload in sql database , this is a short tutorial : Step 1 : create a database : CREATE TABLE binary_data ( id INT(4) NOT NULL AUTO_INCREMENT PRIMARY KEY, description CHAR(50), bin_data LONGBLOB, filename CHAR(50), filesize CHAR(50), filetype CHAR(50) ); Step 2 : create ui to upload : <?php // code that will be executed if the form has been submitted: if ($submit) { // connect to the database // (you may have to adjust the hostname,username or password) MYSQL_CONNECT("localhost","root","password"); mysql_select_db("binary_data"); $data = addslashes(fread(fopen($form_data, "r"), filesize($form_data))); $result=MYSQL_QUERY("INSERT INTO binary_data (description,bin_data,filename,filesize,filetype) ". "VALUES ('$form_description','$data','$form_data_name','$form_data_size','$form_data_type')"); $id= mysql_insert_id(); print "<p>This file has the following Database ID: <b>$id</b>"; MYSQL_CLOSE(); } else { // else show the form to submit new data: ?> <form method="post" action="<?php echo $PHP_SELF; ?>" enctype="multipart/form-data"> File Description:<br> <input type="text" name="form_description" size="40"> <input type="hidden" name="MAX_FILE_SIZE" value="1000000"> <br>File to upload/store in database:<br> <input type="file" name="form_data" size="40"> <p><input type="submit" name="submit" value="submit"> </form> <?php } ?> Step 3 : geting data : <?php if($id) { // you may have to modify login information for your database server: @MYSQL_CONNECT("localhost","root","password"); @mysql_select_db("binary_data"); $query = "select bin_data,filetype from binary_data where id=$id"; $result = @MYSQL_QUERY($query); $data = @MYSQL_RESULT($result,0,"bin_data"); $type = @MYSQL_RESULT($result,0,"filetype"); Header( "Content-type: $type"); echo $data; }; ?> Happy funny ! @};---------------------- |
|
|
|
Oct 24 2004, 10:18 AM
Post
#5
|
|
|
Member [Level 2] ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 75 Joined: 20-October 04 Member No.: 1,847 |
ASP i only working on win systems.
Because , on win you have internet information server. There is some software to install ASP on unix , i think , but i don't know how is it... |
|
|
|
Oct 26 2004, 08:19 PM
Post
#6
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: Members Posts: 66 Joined: 21-October 04 Member No.: 1,872 |
if you need a free asp host, then try searching for that on google. i dont understand what you mean, uploading an asp file is the same as uploading just about any other kind of file, there is nothing different between them.
|
|
|
|
Nov 4 2004, 02:54 PM
Post
#7
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 360 Joined: 17-October 04 Member No.: 1,795 |
Use this host:
www.brinkster.com - chose the free educational package Here you can use asp and asp.net and access databases. I use it, it's very good. The website editor is like frontpage. |
|
|
|
![]() ![]() |
Similar Topics
| Topics | Topics | |
|---|---|---|
|
|
|
|
Lo-Fi Version | Time is now: 13th October 2008 - 09:27 PM |