Data too long for column

Trying to save a profile photo picture during registration and it keeps showing this… Any idea why? I’m currently using your backendless demos to learn. In the folder “FileService,” the upload works fine. Everything’s implemented in the registerviewcontroller but it isn’t working.

-(BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender










{

    if ([identifier isEqualToString:@"Register.RegisterViewController"]) {

        

        self.registration = nil;

        

        NSLog(@"SEND ------> registering: name = %@, password = %@, verify = %@", self.nameInput.text, self.passwordInput.text, self.verifyPasswordInput.text);

        

        if ([self.nameInput.text length] && [self.passwordInput.text length] && [self.passwordInput.text isEqualToString:self.verifyPasswordInput.text])

        {

            self.registration = [Registration new];

            self.registration.name = self.nameInput.text;

            self.registration.password = self.passwordInput.text;

            self.registration.email = self.emailInput.text;

            self.registration.birthday = [NSDate date];

            self.registration.gender = self.maleChoice.selected ? MALE_GENDER_VAL : FEMALE_GENDER_VAL;

            

           @try {

            

            [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];

            

            if (_isUpload)

            {

                [backendless.fileService remove:[NSString stringWithFormat:@"profile/%@", [[self.registration.path pathComponents] lastObject]]];

               // [backendless.persistenceService remove:[Registration class] sid:self.registration.objectId];

                self.registration.path = nil;

                UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Success" message:@"Image has been deleted" delegate:nil cancelButtonTitle:@"Done" otherButtonTitles:nil];

                [alert show];

            }

            else

            {

                

#if 1 // image file

                NSString *fileName = [NSString stringWithFormat:@"profile/%0.0f.jpeg",[[NSDate date] timeIntervalSince1970] ];

#if 1 // use saveFile method

                BackendlessFile *uploadFile = [backendless.fileService saveFile:fileName content:UIImageJPEGRepresentation(self.mainImage, 0.1)];

#else // use upload method

                BackendlessFile *uploadFile = [backendless.fileService upload:fileName content:UIImageJPEGRepresentation(self.mainImage, 0.1)];

#endif

#else // binary array file (test)

                const char myByteArray[] = {0x12,0x23,0x34,0x45,0x56,0x67,0x78,0x89,0x12,0x23,0x34,0x45,0x56,0x67,0x78,0x89};

                NSData *data = [NSData dataWithBytes:myByteArray length:sizeof(myByteArray)];

                BackendlessFile *uploadFile = [backendless.fileService saveFile:@"binary101.bin" content:data overwriteIfExist:YES];

                

                #endif

                

                

                self.registration.path = uploadFile.fileURL;




 

            }

            _isUpload = !_isUpload;

        }




            @catch (Fault *fault)

            {

                NSLog(@"ImageViewController -> upload: FAULT = %@", fault);

                [self showAlert:fault.message];

            }

            

            

            

            // server invoke

            

            BackendlessUser *user = [BackendlessUser new];

            user.email = self.registration.email;

            user.password = self.registration.password;

            user.name = self.registration.name;

//            [user setProperty:LOGIN_PROFILE_KEY object:user.email];

//            [user setProperty:BIRTHDATE_PROFILE_KEY object:self.registration.birthday];

            [user setProperty:GENDER_PROFILE_KEY object:self.registration.gender];

            [user setProperty:IMAGE_PROFILE object:self.registration.path];




            

            

            // test "\n"

            //[user setProperty:@"music" object:@"TEST\nline1\nline2\n"];

            

            NSLog(@"SEND ------> registering: user = %@", user);

            

            if ([self userRegister:user]) {

                return YES;

            }

        }

        

        return NO;

    }

    return YES;

}

Did you create user properties by hand in Backendless Console? I suspect the data type for the IMAGE_PROFILE property is String, which is limited to 500 characters. The URL must be longer than 500 (when it is URL encoded, it tends to get even longer). Try changing the data type for the property to TEXT. You can do that in the Users > User Properties screen.

Regards,
Mark

I created it through the api. Here’s an example url:

 
 
 
 
 
 
 



 photo = "[url=https://api.backendless.com/025CC7FF-E011-46B8-FF10-9CC0545C3C00/v1/files/profile/1454991758.jpeg]https://api.backendless.com/025CC7FF-E011-46B8-FF10-9CC0545C3C00/v1/files/profile/1454991758.jpeg"[/url];;

I counted and that’s less than 100! It is built on like the path of “FileService” in the demo project!

UPDATE: Text worked. Question now would it be affected if it isn’t string?

Same thing, slightly slower performance. We will check why that value could not be stored.