Re: [web2py] Reading a text file after uploading in a form
where can I download the 'reports' module? I am getting error while calling that module. On Thu, Nov 1, 2012 at 1:12 PM, Jim S wrote: > This is working for me. I have a similar requirement. Select a text file > to be processed and pass it to a separate routine to process the file: > > form = SQLFORM.factory( > Field('brillXf1', 'upload', > uploadfolder=os.path.join(request.folder,'uploads'), > label='Brill XF1 File')) > > if form.process().accepted: > fileName = form.vars.brillXf1 > print fileName > from reports import brillToDalex as btd > btd.process('%s/%s' % (os.path.join(request.folder,'uploads'), fileName), > 1) > redirect(URL('nutrientConversion')) > response.flash('File has been uploaded and email will be sent with > results') > > > The form field only returns the file name. You have to specify the path > to it if you are going to use it later as seen in this statement: > > btd.process('%s/%s' % (os.path.join(request.folder,'uploads'), fileName), > 1) > > -Jim > > > On Thursday, November 1, 2012 3:33:50 AM UTC-5, praveen krishna wrote: > >> Nol there is no such requirement.Actually I am able to upload and read a >> text file by zipping it but for my task I have upload a text file . >> >> On Thu, Nov 1, 2012 at 7:24 AM, Johann Spies wrote: >> >> On 31 October 2012 17:45, praveen krishna wrote: >>> Hi, For my task I have to upload a text file in form with out zipping it ,I have prepared the form as: form = FORM(TABLE(TR(TD('Upload File:', INPUT(_type='file', name='myfile', id='myfile', requires=IS_NOT_EMPTY(,TR(TD(INPUT(_type='submit',_value='Submit') But I unable to read the file how could it be possible without using ZipFile. >>> >>> You refer to 'zip' twice. Why? Is there a requirement that it should >>> be zipped somewhere? >>> >>> Regards >>> Johann >>> -- >>> Because experiencing your loyal love is better than life itself, >>> my lips will praise you. (Psalm 63:3) >>> >>> -- >>> >>> >>> >>> >> >> -- > > > > --
Re: [web2py] Reading a text file after uploading in a form
This is working for me. I have a similar requirement. Select a text file to be processed and pass it to a separate routine to process the file: form = SQLFORM.factory( Field('brillXf1', 'upload', uploadfolder=os.path.join(request.folder,'uploads'), label='Brill XF1 File')) if form.process().accepted: fileName = form.vars.brillXf1 print fileName from reports import brillToDalex as btd btd.process('%s/%s' % (os.path.join(request.folder,'uploads'), fileName), 1 ) redirect(URL('nutrientConversion')) response.flash('File has been uploaded and email will be sent with results' ) The form field only returns the file name. You have to specify the path to it if you are going to use it later as seen in this statement: btd.process('%s/%s' % (os.path.join(request.folder,'uploads'), fileName), 1) -Jim On Thursday, November 1, 2012 3:33:50 AM UTC-5, praveen krishna wrote: > > Nol there is no such requirement.Actually I am able to upload and read a > text file by zipping it but for my task I have upload a text file . > > On Thu, Nov 1, 2012 at 7:24 AM, Johann Spies > > wrote: > >> On 31 October 2012 17:45, praveen krishna >> > wrote: >> >>> Hi, >>>For my task I have to upload a text file in form with out zipping it >>> ,I have prepared the form as: >>> form = FORM(TABLE(TR(TD('Upload File:', INPUT(_type='file', >>> name='myfile', id='myfile', >>> requires=IS_NOT_EMPTY(,TR(TD(INPUT(_type='submit',_value='Submit') >>> >>> But I unable to read the file how could it be possible without using >>> ZipFile. >>> >> >> You refer to 'zip' twice. Why? Is there a requirement that it should >> be zipped somewhere? >> >> Regards >> Johann >> -- >> Because experiencing your loyal love is better than life itself, >> my lips will praise you. (Psalm 63:3) >> >> -- >> >> >> >> > > --
Re: [web2py] Reading a text file after uploading in a form
Nol there is no such requirement.Actually I am able to upload and read a text file by zipping it but for my task I have upload a text file . On Thu, Nov 1, 2012 at 7:24 AM, Johann Spies wrote: > On 31 October 2012 17:45, praveen krishna wrote: > >> Hi, >>For my task I have to upload a text file in form with out zipping it >> ,I have prepared the form as: >> form = FORM(TABLE(TR(TD('Upload File:', INPUT(_type='file', >> name='myfile', id='myfile', >> requires=IS_NOT_EMPTY(,TR(TD(INPUT(_type='submit',_value='Submit') >> >> But I unable to read the file how could it be possible without using >> ZipFile. >> > > You refer to 'zip' twice. Why? Is there a requirement that it should be > zipped somewhere? > > Regards > Johann > -- > Because experiencing your loyal love is better than life itself, > my lips will praise you. (Psalm 63:3) > > -- > > > > --
Re: [web2py] Reading a text file after uploading in a form
On 31 October 2012 17:45, praveen krishna wrote: > Hi, >For my task I have to upload a text file in form with out zipping it ,I > have prepared the form as: > form = FORM(TABLE(TR(TD('Upload File:', INPUT(_type='file', name='myfile', > id='myfile', > requires=IS_NOT_EMPTY(,TR(TD(INPUT(_type='submit',_value='Submit') > > But I unable to read the file how could it be possible without using > ZipFile. > You refer to 'zip' twice. Why? Is there a requirement that it should be zipped somewhere? Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) --
[web2py] Reading a text file after uploading in a form
Hi, For my task I have to upload a text file in form with out zipping it ,I have prepared the form as: form = FORM(TABLE(TR(TD('Upload File:', INPUT(_type='file', name='myfile', id='myfile', requires=IS_NOT_EMPTY(,TR(TD(INPUT(_type='submit',_value='Submit') But I unable to read the file how could it be possible without using ZipFile. --