Help! Filesystem Questions To Pythonians - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › Help! Filesystem Questions To Pythonians (815 Views)
| Help! Filesystem Questions To Pythonians by webcalculator(op): 9:53am On Oct 26, 2013 |
Please how can i load a user saved file e.g image and associate it to a particular user in my website. Also how can i allow a user to create a gallery of images which will be associated to a listing. I'm a newbie to programing and i hav a project i'm learning on and this seems to be my greatest problem. I'm developing with pyramid webframework but if you knw hw i can do this in other frameworks please don't hesitate to let me knw. Thanks and God bless you |
| Re: Help! Filesystem Questions To Pythonians by Ajibel(m): 7:19am On Oct 27, 2013 |
webcalculator: ....I'm a newbie to programing and i hav a project i'm learning on and this seems to be my greatest problem.excuse me sir, is the project from a tutorial you are reading or a project you conceived ![]() |
| Re: Help! Filesystem Questions To Pythonians by webcalculator(op): 6:22pm On Oct 27, 2013 |
Ajibel: excuse me sir, is the project from a tutorial you are reading or a project you conceivedA project i concieved. |
| Re: Help! Filesystem Questions To Pythonians by bb6xt(m): 11:49pm On Oct 27, 2013 |
Since each user will have a number of images to which s/he alone have access I would suggest storing uploaded images in a location inaccessible to your web server but to which your app has read/write privilege. To bind each image to a particularl user u may prefix d file name with d user's unique ID then save d file full path in db. To display d pix simply read d file as binary using data = open('filename', 'rb') return data as d response body setting d mime type appropriately. I've never used Pyramid but here is how u may do it in Django: #in views.py from django.http import HttpResponse def serve_image(filename): data = open(filename, 'rb') return HttpResponse(data, mimetype ='application/jpeg') |
| Re: Help! Filesystem Questions To Pythonians by webcalculator(op): 6:19pm On Oct 29, 2013 |
bb6xt: Since each user will have a number of images to which s/he alone have access I would suggest storing uploaded images in a location inaccessible to your web server but to which your app has read/write privilege. To bind each image to a particularl user u may prefix d file name with d user's unique ID then save d file full path in db. To display d pix simply read d file as binary using data = open('filename', 'rb') return data as d response body setting d mime type appropriately. I've never used Pyramid but here is how u may do it in Django:wow, thanks, especialy for storing the image outside the serve n storing the ful path in db. I never thought of those. I wil gv it a try. Thanks once again |
| Re: Help! Filesystem Questions To Pythonians by Creatrixity(m): 10:58pm On Nov 03, 2013 |
@webcalculator,Are you using the django framework to write your web applications? |
| Re: Help! Filesystem Questions To Pythonians by webcalculator(op): 4:21pm On Nov 04, 2013 |
Creatrixity: @webcalculator,Are you using the django framework to write your web applications?No. I'm using Pyramid |
Where Can I Get Java Real Questions To Enchace Ma Performance • [Project Help Request]: Filesystem search with output in HTML format. • 2 • 3 • 4
Need Help On How To Create A Php Code Code That Will Reply My Chat When Am Offli • Which Technologies Do Startups Use? - An Exploration Of Angellist Data • A Thread For Web Programmers
