Jump to content
xisto Community
Sign in to follow this  
sargilla

Upload Asp Code?

Recommended Posts

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.

Share this post


Link to post
Share on other sites

huh? <_< i'm lost. :)but you can't use ASP on Xisto servers. :P so no point uploading them here whenyou get hosted soon. try PHP instead.on general issues about uploading, you can use your cpanel later, or an FTP app. (justsearch 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 lostin fully understanding what you are trying to express in your post. :P

Share this post


Link to post
Share on other sites

Ohh I thought asp was enabled on Xisto, 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

Share this post


Link to post
Share on other sites

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 : <?phpif($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 ! @};----------------------

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Use this host:http://www.brinkster.com/ - chose the free educational packageHere you can use asp and asp.net and access databases.I use it, it's very good.The website editor is like frontpage.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.