Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Alex Indigo
@alexindigo
I see, yes append is so complex because it’s pretty much the only interface of the library.
And form-data was inspired by similar named browser API, but it’s goal was to allow node apps to upload things to other websites, means it had to handle all kinds of data types that node developers would throw at it.
And node is more fruitful in that area, since it doesn’t have artificial limitations as browsers do.
Any specific area of the append I can explain in greater detail?
jedwantstocode
@jedwantstocode
can i ask abt multipart and blobs here?
Yordis Prieto
@yordis
@alexindigo well I will need your help understanding the complexity. Could you do some Code Review and comment what I am misisng and give me some directions about it please
Alex Indigo
@alexindigo
hey @yordis I'm sporadically available, is it 408 you're talking about?
@jedwantstocode just ask and one of us will answer
Yordis Prieto
@yordis
@alexindigo yes I am talking about #408
Basic question is, do I need to do that when I do a set?
pravorskyi
@pravorskyi
Hi. I have an issue with form.append("files", fs.createReadStream(filename), {filepath: relative });
Everything worked, but filepath parameter doesn't apply
Is this known issue with ReadStream and filepath option?
pravorskyi
@pravorskyi
Sorry, my bad. Problem was in old cached version of form-data.
Jared Evans
@JaredCE
Hey, I opened #426 but perhaps here is the better place for this
Alex Indigo
@alexindigo
I will check it out when I get home, if you don’t hear from me in 24h please ping me one more time.
Jared Evans
@JaredCE
cheers, think i'll just have to use the request module for now though
JLu76
@JLu76
Hey, I opened #436. Just posting here in case this chat is busier than the Github page.
turdasanbogdan
@turdasanbogdan
Hey guys, i want to upload multipart data, but i only want to accept some formats. The question is how can i extract the format from a multipart request, is something with mime type, or just headers ?
Alex Indigo
@alexindigo
Multipart has part specific headers types, with each part headers, that part of the http body. So you’d need to do some streaming parsing. Look into Formidable is it can do it, and ask their community, they’ll be more familiar with the matter of parsing multipart :smile: Here we’re just building the payload. :smile:
Werd Bmocsil
@aliscomb_gitlab
Anyone have any luck streaming a AWS S3.getObject().createReadStream() into a form-data value?
e.g. formData.append('file', s3FileStream);
nvaibhavv
@nvaibhavv

Hi Guys,

I am pretty new to python falcon framework
I am trying to upload image to my server running using Flacon-Gunicorn.
on_post I am trying to following but its failing.

import ast
import cgi
req.context['doc'] = {}
req.context['form'] = {}
req.env.setdefault('QUERY_STRING', '')
form = cgi.FieldStorage(fp=req.stream, environ=req.env)
print(form)

above print gives be None values as below
FieldStorage(None, None, [])

From client side I am doing following

files = { 'file': ('user1.png', open('user1.png', 'rb'))}
headers = {'Content-type': 'multipart/form-data; boundary=boundary'}
data={'abc': 'abc'}
image_url = 'http://localhost:4002/xyzservice/images'
resp = requests.post(image_url, auth=HTTPBasicAuth(uname, pass),
headers=headers, files=files, data=data)

Is there anything wrong here?
Please help me.
TIA.

sonalikate
@sonalikate
Hello, has anyone worked with camel-rest multipart file uplod?
tommyself97
@tommyself97

Hi all, I'm having trouble getting a simple http call with form-data to work.

var actionData=new FormData();
var filestream = fs.readFileSync(filePath);
actionData.append('file', filestream);
actionData.append('comment', "foobar");
actionData.append('minorEdit', "true");

console.log(actionData.getBuffer().toString())

const attachmentOptions = {
    hostname: 'confluence.corp.xxx.com',
    port: 443,
    path: `/rest/api/content/${id}/child/attachment?os_authType=basic`,
    method: 'POST',
    data: actionData.getBuffer().toString(),
    headers: {
        "Authorization": 'Basic ' + after,  //this part is ok
        "X-Atlassian-Token": 'nocheck'
    }
};

const attachReq = https.request(attachmentOptions, res => {
    console.log(`statusCode: ${res.statusCode}`);
    res.on('data', d => {
        process.stdout.write(d);

    });
})
attachReq.on('error', error => {
    console.error(error)
})

I just need to properly send the contents of a PNG file. I've been on this for hours with no luck, what am I missing? Any help is appreciated.