How can I upload images

Hi everyone :slight_smile:
How can I add images to a page without the panel?
Can I do it directly when creating the page? So with page()->create() or how do I do it?

   $image = array('name' => $title, 'type' => 'image/jpg', 'bits' => new IXR_Base64($theData), 
   'overwrite' => true, 'post_id' => $post_id );
   curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(
		array('data_id' => $data_id, 'ID' => $data->ID, 'project' => $project, 'parent' => $data- 
    >parent, 'imgsrcfolder' => $data->imgsrcfolder, 'image' => $image, 'text' => $data->text))

    $image = get('image');
    $p = page($category)->children()->create($pagenameM, 'default', array(
        'title' => $title,
        'text' => $text,

Check out this thread: Allow guests to create pages from Panel or frontend