When you create an upload field using the DAL, the filename is stored in 
the upload field itself, so you can get the filepath via:

import os
filepath = os.path.join(request.folder, 'uploads', row.upload_field_name)

The above assumes all uploads go directly in the /uploads folder. If you 
have specified an alternative upload folder, you will need to use that 
instead of "uploads" (also, if you set uploadseparate=True, that will take 
some extra work to get the full path).

Anthony

On Tuesday, June 30, 2015 at 3:30:28 AM UTC-4, reddyreddy wrote:
>
> I have a form where student can submit his .c programs. Now I want to 
> write a script that run these programs. I was able compile and run c 
> programs with a python scripts with normal name like hello.c. But Iam not 
> sure how can refer these programs that were saved with random name. Here is 
> my script.
>
>
> ## in file /app/private/mail_queue.py
> import time
> import subprocess
> while True:
> rows = db(db.student.status=='pending').select()
> ofile = 
> open('C:\\web2py\\applications\\newdropboxmultiupload\\cache\\temp\\hellonewtest.out',
>  
> 'w')
> for row in rows:
>  subprocess.call(["gcc","C:\web2py\hello.c","-o","x"])
> subprocess.call(["./x"], stdout=ofile)
> row.update_record(status='executed') 
> db.commit()
> time.sleep(60) # check every minute
> ofile.close()
>  
>
> On Fri, Jun 26, 2015 at 3:19 AM, Manuele Pesenti <
> manuele.pese...@gmail.com> wrote:
>
>> Il 24/06/15 21:23, Chaitu P ha scritto:
>> > I want to compile the files that were uploaded. But the files are
>> > getting uploaded with some random name. So how can I refer them.
>> Please give more ditails of what you are trying to do... I guess you are
>> using a "no dal" form to upload your files... right?
>>
>>     M.
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Chaitanya Pochampally
>  

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to