See More
Popular Forum

MBA (4887) B.Tech (1769) Engineering (1486) Class 12 (1030) Study Abroad (1004) Computer Science and Engineering (988) Business Management Studies (865) BBA (846) Diploma (746) CAT (651) B.Com (648) B.Sc (643) JEE Mains (618) Mechanical Engineering (574) Exam (525) India (462) Career (452) All Time Q&A (439) Mass Communication (427) BCA (417) Science (384) Computers & IT (Non-Engg) (383) Medicine & Health Sciences (381) Hotel Management (373) Civil Engineering (353) MCA (349) Tuteehub Top Questions (348) Distance (340) Colleges in India (334)
See More

How to save a form's 'file' input to disk?

Course Queries Syllabus Queries
Max. 2000 characters

Sam Curran


( 5 months ago )


I have never done anything of this sort and I can't seam to find a decent tutorial to teach me how to do this...

I have an html form as follow:

<form class = "form-course-setup" id="form-course-add" action="" enctype="multipart/form-data">
<input type="file" name="syllabus" size="40"> 
            if(data == true)

in lecturer_addcourse.php

I would want to save the syllabus attachment to remote server (to be downloaded later on)...

How can I do that?

PS: If this not stack overflow type of questions please let me know and I would gladly delete this post :)

Nicola Aley


( 5 months ago )

Due to outdated security models, browsers never allowed javascript to read files. The latest browsers can do now it, but only via the FileReader API. If you want to do this yourself it will be days lf work. Or you can find a third party library such as "FineUploader".

Much easier is just to remove your javascript completely and do <form action="../php/lecturer_addcourse.php" ...>

Also, make sure your php script does not allow anyone to upload php scripts. A lot of servers get hacked by making that mistake.

what's your interest