Jump to content

upload file function maybe?!


jp15

Recommended Posts

Hi there,

I wonder if you can help me, now I’m not a pro at php, pretty basic to be honest but I need some help with a system I am creating for my third year project at uni.

I need to know how I could provide means for a user to upload a file or provide a link to a file and have that same file displayed on the page once they have done so (if that makes sense). This is so they can organise their resources for and then access them at a later date for whatever reason. If you could provide me with some idea of what this would involve or point me in the direction of some code that would allow me to do this, I would be grateful.

 

Kind Regards

 

Link to comment
Share on other sites

Ofc it was sarcastic post but the way I see yor question is like "Hmm I need my project todo but I am so lazy and I wonna go to party I will try find some dump nerd-ass  maybe they will give me some code :D:D and I will finish uni and will be engineer"

 

Plus u didnt' showed any code  that prooved that u atleast tried something to code..

U say u tried some tutorials and how u think file upload form with some <input type='file'>fields will suite your needs or u wan to upload files via ftp or what?

Link to comment
Share on other sites

The sarcastic response was triggered by the witty remark about using Google!!

Sado, just to try and set the record straight, Im not here to offend anybody, and I respect the the wealth of knowledge provided on such sights like this. I am now aware of the sensitive nature though, my problem was genuine, I haven’t produced any code as I didn’t no where to start. I have however, spent many, many hours coding my website to a certain standard. I could not get my head around the concept of how to do, what i wanted to do. So I guess it was more of a discussion of the possibilities I was looking for, or a framework of code as a starting point.

My intentions of leaving uni are to become an IT consultant and not an engineer in that respect and I’m honest enough to say my technical abilities aren’t my strong point - this is why I attempted to seek help.

I don’t appreciate assumptions based on what I want from a "dump ass nerd", not my intention at all, I am not that sort of person. I just thought this would be a good place to come for some ideas.

Thanks for your time and soz for any misunderstanding.  :D

 

Link to comment
Share on other sites

ym_chaitu apologies for the eventful post, just felt like I was being judged as It appears my intentions were misconstrued!

Thank you for the scripts, I will have a look and let you know how I get on,

Thanks again much appreciated.  :D

 

Link to comment
Share on other sites

Everything and I do mean everything you need to know to do this in php is in the manual page here:  http://us2.php.net/manual/en/features.file-upload.post-method.php

 

In a nutshell:

 

-You need to make an html form that includes the form enctype="multipart/form-data" AND the html element needs to be a type="file".  The browser then performs the magic of giving you a widget that ties into the OS and lets you find files.  Once the form is submitted, php kicks in and

 

-Puts the information about the uploaded file into a magic superglobal array named $_FILES. 

 

-You must then take the temporary name, and use the php move_uploaded_file() function to move the file to it's final destination.  That is sometihng you decide, and permissions must allow the file to be written into this location.

 

If there are no errors, the file should now be located and you can then read it back out and display it, assuming the structure is displayable.

 

There is more or less complete source to do this in the manual section I linked.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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.