Hear is PHP example (to show what is my wish to do): in HTML: <html> <body>
<form action="upload_file.php" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" id="file" /> <br /> <input type="submit" name="submit" value="Submit" /> </form> </body> </html> in PHP file upload_file.php: <?php if ($_FILES["file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Stored in: " . $_FILES["file"]["tmp_name"]; } ?> Is this possible with Python and web2py? Miroslav On Nov 19, 8:53 am, miroslavgojic <miroslavgo...@gmail.com> wrote: > I reed all in online book about upload and forms... > > Can I make my upload manually, something like: brows_file -> > upload_to_some_folder. > What is happening after I submit button 'upload' - can I have control > on this activity. > > I'm new with Web2Py and Python, but on PHP this is no problem, I make > all my code upload form and files go to folders what I chose, and file > name is my will same or changed... > In Python I see some functions os.rename for renaming files, but it is > directly rename file name. > > Can I have may custom upload form with two way > first: sending file to folder - no need for database > second: sending data to database - and don'n need to know is file or > something else. > > On download process I can us something like list folder content and > make links for download (from file list and database data I will > generate links for download) > > If you have doubts why so complicated, and why I don't use simply way > shown in book -> answer is: the chairman of department what that files > stored as early mentioned... > > Miroslav > > On Nov 19, 12:40 am, Anthony <abasta...@gmail.com> wrote: > > > > > > > > > On Friday, November 18, 2011 5:55:59 PM UTC-5, miroslavgojic wrote: > > > > some questions: > > > > Can I turnoff default changing name with upload function? > > > I don't think so. As an alternative, process the form with dbio=False so it > > doesn't do the upload or database insert, and then manually process the > > upload however you want and store your filename in the db. > > Seehttp://web2py.com/book/default/chapter/07#SQLFORM-without-database-IO. > > > Anthony